1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 8 #ifndef _CC_ECPKI_KG_H 9 #define _CC_ECPKI_KG_H 10 11 /*! @file 12 @brief This file defines the API for generation of ECC private and public keys. 13 @defgroup cc_ecpki_kg CryptoCell ECC Key Generation APIs 14 @{ 15 @ingroup cryptocell_ecpki 16 17 */ 18 19 20 #include "cc_error.h" 21 #include "cc_rnd_common.h" 22 #include "cc_ecpki_types.h" 23 24 #ifdef __cplusplus 25 extern "C" 26 { 27 #endif 28 29 /***************** CC_EcpkiKeyPairGenerate function **********************/ 30 /*! 31 @brief Generates a pair of private and public keys in internal representation according to ANSI X9.62-2005: Public Key Cryptography for the 32 Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA) standard. 33 34 @return CC_OK on success. 35 @return A non-zero value on failure as defined cc_ecpki_error.h or cc_rnd_error.h 36 */ 37 CIMPORT_C CCError_t CC_EcpkiKeyPairGenerate( 38 CCRndContext_t *pRndContext, /*!< [in/out] Pointer to the RND context buffer. */ 39 const CCEcpkiDomain_t *pDomain, /*!< [in] Pointer to EC domain (curve). */ 40 CCEcpkiUserPrivKey_t *pUserPrivKey, /*!< [out] Pointer to the private key structure. This structure is used as input to the 41 ECPKI cryptographic primitives. */ 42 CCEcpkiUserPublKey_t *pUserPublKey, /*!< [out] Pointer to the public key structure. This structure is used as input to the 43 ECPKI cryptographic primitives. */ 44 CCEcpkiKgTempData_t *pTempData, /*!< [in] Temporary buffers for internal use, defined in ::CCEcpkiKgTempData_t. */ 45 CCEcpkiKgFipsContext_t *pFipsCtx /*!< [in] Pointer to temporary buffer used in case FIPS certification if required 46 (may be NULL for all other cases). */ 47 ); 48 49 /***************** CC_EcpkiKeyPairGenerateBase function **********************/ 50 /*! 51 @brief Generates a pair of private and public keys using a configurable base point 52 in internal representation according to ANSI X9.62-2005: Public Key Cryptography for the 53 Financial Services Industry, The Elliptic Curve Digital Signature Algorithm (ECDSA) standard. 54 55 @return CC_OK on success. 56 @return A non-zero value on failure as defined cc_ecpki_error.h or cc_rnd_error.h 57 */ 58 CIMPORT_C CCError_t CC_EcpkiKeyPairGenerateBase( 59 CCRndContext_t *pRndContext, /*!< [in/out] Pointer to RND context. */ 60 const CCEcpkiDomain_t *pDomain, /*!< [in] Pointer to EC domain (curve). */ 61 const uint32_t *ecX_ptr, /*!< [in] The X cordinate of the base point. */ 62 const uint32_t *ecY_ptr, /*!< [in] The Y cordinate of the base point. */ 63 CCEcpkiUserPrivKey_t *pUserPrivKey, /*!< [out] Pointer to the private key structure. This structure is used as input to the 64 ECPKI cryptographic primitives. */ 65 CCEcpkiUserPublKey_t *pUserPublKey, /*!< [out] Pointer to the public key structure. This structure is used as input to the 66 ECPKI cryptographic primitives. */ 67 CCEcpkiKgTempData_t *pTempData, /*!< [in] Temporary buffers for internal use, defined in ::CCEcpkiKgTempData_t. */ 68 CCEcpkiKgFipsContext_t *pFipsCtx /*!< [in] Pointer to temporary buffer used in case FIPS certification if required 69 (may be NULL for all other cases). */ 70 ); 71 72 73 74 #ifdef __cplusplus 75 } 76 #endif 77 /** 78 @} 79 */ 80 #endif 81 82 83 84 85