Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
crys_rsa_kg.h
00001 /************************************************************************************** 00002 * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved * 00003 * * 00004 * This file and the related binary are licensed under the following license: * 00005 * * 00006 * ARM Object Code and Header Files License, v1.0 Redistribution. * 00007 * * 00008 * Redistribution and use of object code, header files, and documentation, without * 00009 * modification, are permitted provided that the following conditions are met: * 00010 * * 00011 * 1) Redistributions must reproduce the above copyright notice and the * 00012 * following disclaimer in the documentation and/or other materials * 00013 * provided with the distribution. * 00014 * * 00015 * 2) Unless to the extent explicitly permitted by law, no reverse * 00016 * engineering, decompilation, or disassembly of is permitted. * 00017 * * 00018 * 3) Redistribution and use is permitted solely for the purpose of * 00019 * developing or executing applications that are targeted for use * 00020 * on an ARM-based product. * 00021 * * 00022 * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * 00023 * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * 00024 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, * 00025 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * 00026 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * 00028 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * 00029 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * 00030 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * 00031 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * 00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 00033 **************************************************************************************/ 00034 00035 00036 00037 00038 #ifndef CRYS_RSA_KG_H 00039 #define CRYS_RSA_KG_H 00040 00041 #include "crys_rsa_types.h" 00042 #include "crys_rnd.h" 00043 00044 #ifdef __cplusplus 00045 extern "C" 00046 { 00047 #endif 00048 00049 /*! 00050 @file 00051 @brief Generates a RSA pair of public and private keys. 00052 @defgroup crys_rsa_kg CryptoCell RSA key generation APIs 00053 @{ 00054 @ingroup crys_rsa 00055 */ 00056 00057 /************************ Defines ******************************/ 00058 00059 /* Max allowed size and values of public exponent for key generation in CRYS */ 00060 /*! Maximal public exponent size in bits. */ 00061 #define CRYS_RSA_KG_PUB_EXP_MAX_SIZE_BITS 17 00062 /*! Definition of public exponent value. */ 00063 #define CRYS_RSA_KG_PUB_EXP_ALLOW_VAL_1 0x000003 00064 /*! Definition of public exponent value. */ 00065 #define CRYS_RSA_KG_PUB_EXP_ALLOW_VAL_2 0x000011 00066 /*! Definition of public exponent value. */ 00067 #define CRYS_RSA_KG_PUB_EXP_ALLOW_VAL_3 0x010001 00068 00069 00070 00071 00072 /***********************************************************************************************/ 00073 00074 /*! 00075 @brief CRYS_RSA_KG_GenerateKeyPair generates a Pair of public and private keys on non CRT mode according to [ANS X9.31]. 00076 00077 \note To be FIPS 186-4 [5.1] compliant use only the following key sizes (in bits): 1024, 2048 and 3072. 00078 00079 @return CRYS_OK on success. 00080 @return A non-zero value from crys_rsa_error.h or crys_rnd_error.h on failure. 00081 00082 */ 00083 00084 CIMPORT_C CRYSError_t CRYS_RSA_KG_GenerateKeyPair( 00085 void *rndState_ptr, /*!< [in/out] Pointer to the RND state structure. */ 00086 SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, /*!< [in] Pointer to the random vector generation function. */ 00087 uint8_t *pubExp_ptr, /*!< [in] The pointer to the public exponent (public key). */ 00088 uint16_t pubExpSizeInBytes, /*!< [in] The public exponent size in bytes. */ 00089 uint32_t keySize, /*!< [in] The size of the key, in bits. Supported sizes are 00090 512, 1024, 2048, 3072 and 4096 bit. */ 00091 CRYS_RSAUserPrivKey_t *userPrivKey_ptr, /*!< [out] Pointer to the private key structure. */ 00092 CRYS_RSAUserPubKey_t *userPubKey_ptr, /*!< [out] Pointer to the public key structure. */ 00093 CRYS_RSAKGData_t *keyGenData_ptr, /*!< [in] Pointer to a temporary structure required for the KeyGen operation. */ 00094 CRYS_RSAKGFipsContext_t *pFipsCtx /*!< [in] Pointer to temporary buffer used in case FIPS certification if required. */ 00095 ); 00096 00097 /***********************************************************************************************/ 00098 /*! 00099 @brief Generates a pair of public and private keys on CRT mode according to [ANS X9.31]. 00100 00101 \note To be FIPS 186-4 [5.1] compliant use only the following key sizes (in bits): 1024, 2048 and 3072. 00102 00103 @return CRYS_OK on success. 00104 @return A non-zero value from crys_rsa_error.h or crys_rnd_error.h on failure. 00105 */ 00106 00107 CIMPORT_C CRYSError_t CRYS_RSA_KG_GenerateKeyPairCRT( 00108 void *rndState_ptr, /*!< [in/out] Pointer to the RND state structure. */ 00109 SaSiRndGenerateVectWorkFunc_t rndGenerateVectFunc, /*!< [in] Pointer to the random vector generation function. */ 00110 uint8_t *pubExp_ptr, /*!< [in] The pointer to the public exponent (public key). */ 00111 uint16_t pubExpSizeInBytes, /*!< [in] The public exponent size in bytes. */ 00112 uint32_t keySize, /*!< [in] The size of the key, in bits. Supported sizes are 00113 512, 1024, 2048, 3072 and 4096 bit. */ 00114 CRYS_RSAUserPrivKey_t *userPrivKey_ptr, /*!< [out] Pointer to the private key structure. */ 00115 CRYS_RSAUserPubKey_t *userPubKey_ptr, /*!< [out] Pointer to the public key structure. */ 00116 CRYS_RSAKGData_t *keyGenData_ptr, /*!< [in] Pointer to a temporary structure required for the KeyGen operation. */ 00117 CRYS_RSAKGFipsContext_t *pFipsCtx /*!< [in] Pointer to temporary buffer used in case FIPS certification if required. */ 00118 ); 00119 00120 00121 #ifdef __cplusplus 00122 } 00123 #endif 00124 /** 00125 @} 00126 */ 00127 #endif 00128 00129
Generated on Tue Jul 12 2022 13:54:15 by
