crys_ecpki_dh.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /**************************************************************************************
  2. * Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
  3. * *
  4. * This file and the related binary are licensed under the following license: *
  5. * *
  6. * ARM Object Code and Header Files License, v1.0 Redistribution. *
  7. * *
  8. * Redistribution and use of object code, header files, and documentation, without *
  9. * modification, are permitted provided that the following conditions are met: *
  10. * *
  11. * 1) Redistributions must reproduce the above copyright notice and the *
  12. * following disclaimer in the documentation and/or other materials *
  13. * provided with the distribution. *
  14. * *
  15. * 2) Unless to the extent explicitly permitted by law, no reverse *
  16. * engineering, decompilation, or disassembly of is permitted. *
  17. * *
  18. * 3) Redistribution and use is permitted solely for the purpose of *
  19. * developing or executing applications that are targeted for use *
  20. * on an ARM-based product. *
  21. * *
  22. * DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  23. * CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
  24. * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
  25. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
  26. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
  27. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED *
  28. * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
  29. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  30. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
  31. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
  32. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
  33. **************************************************************************************/
  34. #ifndef CRYS_ECPKI_DH_H
  35. #define CRYS_ECPKI_DH_H
  36. /*! @file
  37. @brief Defines the API that supports EC Diffie-Hellman shared secret value derivation primitives.
  38. @defgroup crys_ecpki_dh CryptoCell ECC Diffie-Hellman APIs
  39. @{
  40. @ingroup cryptocell_ecpki
  41. */
  42. #include "crys_ecpki_types.h"
  43. #include "crys_ecpki_error.h"
  44. #ifdef __cplusplus
  45. extern "C"
  46. {
  47. #endif
  48. /***********************************************************************
  49. * CRYS_ECDH_SVDP_DH function *
  50. ***********************************************************************/
  51. /*!
  52. @brief Creates the shared secret value according to [IEEE1363, ANS X9.63]:
  53. <ol><li> Checks input-parameter pointers and EC Domain in public and private
  54. keys.</li>
  55. <li> Derives the partner public key and calls the EcWrstDhDeriveSharedSecret
  56. function, which performs EC SVDP operations.</li></ol>
  57. \note The term "User"
  58. refers to any party that calculates a shared secret value using this primitive.
  59. The term "Partner" refers to any other party of shared secret value calculation.
  60. Partner's public key shall be validated before using in this primitive.
  61. @return CRYS_OK on success.
  62. @return A non-zero value on failure as defined crys_ecpki_error.h.
  63. */
  64. CIMPORT_C CRYSError_t CRYS_ECDH_SVDP_DH(
  65. CRYS_ECPKI_UserPublKey_t *PartnerPublKey_ptr, /*!< [in] Pointer to a partner public key. */
  66. CRYS_ECPKI_UserPrivKey_t *UserPrivKey_ptr, /*!< [in] Pointer to a user private key. */
  67. uint8_t *SharedSecretValue_ptr, /*!< [out] Pointer to an output buffer that will contain the shared
  68. secret value. */
  69. uint32_t *SharedSecrValSize_ptr, /*!< [in/out] Pointer to the size of user-passed buffer (in) and
  70. actual size of output of calculated shared secret value
  71. (out). */
  72. CRYS_ECDH_TempData_t *TempBuff_ptr /*!< [in] Pointer to a temporary buffer. */);
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. /**
  77. @}
  78. */
  79. #endif