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_DH_H 9 #define _CC_ECPKI_DH_H 10 11 /*! @file 12 @brief This file defines the API that supports EC Diffie-Hellman shared secret value derivation primitives. 13 @defgroup cc_ecpki_dh CryptoCell ECC Diffie-Hellman APIs 14 @{ 15 @ingroup cryptocell_ecpki 16 17 */ 18 19 20 #include "cc_ecpki_types.h" 21 #include "cc_ecpki_error.h" 22 23 #ifdef __cplusplus 24 extern "C" 25 { 26 #endif 27 28 /*********************************************************************** 29 * CC_EcdhSvdpDh function * 30 ***********************************************************************/ 31 /*! 32 @brief Creates the shared secret value according to IEEE 1363-2000: IEEE Standard for Standard Specifications for Public-Key Cryptography standard 33 and ANSI X9.63-2011: Public Key Cryptography for the Financial Services Industry - Key Agreement and Key Transport Using 34 Elliptic Curve Cryptography standard: 35 <ol><li> Checks input-parameter pointers and EC Domain in public and private 36 keys.</li> 37 <li> Derives the partner public key and calls the EcWrstDhDeriveSharedSecret 38 function, which performs EC SVDP operations.</li></ol> 39 \note The term "User" 40 refers to any party that calculates a shared secret value using this primitive. 41 The term "Partner" refers to any other party of shared secret value calculation. 42 Partner's public key shall be validated before using in this primitive. 43 44 @return CC_OK on success. 45 @return A non-zero value on failure as defined cc_ecpki_error.h. 46 */ 47 CIMPORT_C CCError_t CC_EcdhSvdpDh( 48 CCEcpkiUserPublKey_t *PartnerPublKey_ptr, /*!< [in] Pointer to a partner public key. */ 49 CCEcpkiUserPrivKey_t *UserPrivKey_ptr, /*!< [in] Pointer to a user private key. */ 50 uint8_t *SharedSecretValue_ptr, /*!< [out] Pointer to an output buffer that contains the shared 51 secret value. */ 52 size_t *SharedSecrValSize_ptr, /*!< [in/out] Pointer to the size of user-passed buffer (in) and 53 actual size of output of calculated shared secret value 54 (out). */ 55 CCEcdhTempData_t *TempBuff_ptr /*!< [in] Pointer to a temporary buffer. */); 56 57 #ifdef __cplusplus 58 } 59 #endif 60 /** 61 @} 62 */ 63 #endif 64