Mistake on this page?
Report an issue in GitHub or email us
crys_hkdf.h
Go to the documentation of this file.
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 
35 
36 #ifndef CRYS_HKDF_H
37 #define CRYS_HKDF_H
38 
39 #include "crys_hash.h"
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
46 /*!
47 @file
48 @brief This module defines the API that supports HMAC Key derivation function as defined by RFC5869.
49 @defgroup crys_hkdf CryptoCell HMAC Key Derivation APIs
50 @{
51 @ingroup cryptocell_api
52 */
53 
54 /*! HKDF maximal key size in words. */
55 #define CRYS_HKDF_MAX_HASH_KEY_SIZE_IN_BYTES 512
56 
57 /*! HKDF maximal HASH digest size in bytes. */
58 #define CRYS_HKDF_MAX_HASH_DIGEST_SIZE_IN_BYTES CRYS_HASH_SHA512_DIGEST_SIZE_IN_BYTES
59 
60 /************************ Defines ******************************/
61 
62 /************************ Enums ********************************/
63 
64 /*! Enum defining HKDF HASH available modes. */
65 typedef enum
66 {
67  /*! SHA1 mode. */
69  /*! SHA224 mode. */
71  /*! SHA256 mode. */
73  /*! SHA384 mode. */
75  /*! SHA512 mode. */
77 
78  /*! Maximal number of HASH modes. */
80 
81  /*! Reserved */
83 
85 
86 /************************ Typedefs ****************************/
87 
88 /************************ Structs ******************************/
89 
90 /************************ Public Variables **********************/
91 
92 /************************ Public Functions **********************/
93 
94 /****************************************************************/
95 
96 
97 /*********************************************************************************************************/
98 /*!
99 @brief CRYS_HKDF_KeyDerivFunc performs the HMAC-based key derivation, according to RFC5869
100 
101 @return CRYS_OK on success.
102 @return A non-zero value on failure as defined crys_kdf_error.h, crys_hash_error or crys_hmac_error.h
103 */
105  CRYS_HKDF_HASH_OpMode_t HKDFhashMode, /*!< [in] The HKDF identifier of hash function to be used. */
106  uint8_t* Salt_ptr, /*!< [in] A pointer to a non secret random value. can be NULL. */
107  size_t SaltLen, /*!< [in] The size of the salt_ptr. */
108  uint8_t* Ikm_ptr, /*!< [in] A pointer to a input key message. */
109  uint32_t IkmLen, /*!< [in] The size of the input key message */
110  uint8_t* Info, /*!< [in] A pointer to an optional context and application specific information. can be NULL */
111  uint32_t InfoLen, /*!< [in] The size of the info. */
112  uint8_t* Okm, /*!< [in] A pointer to a output key material. */
113  uint32_t OkmLen, /*!< [in] The size of the output key material. */
114  SaSiBool IsStrongKey /*!< [in] if TRUE , then no need to perform the extraction phase. */
115  );
116 
117 #ifdef __cplusplus
118 }
119 #endif
120 /**
121 @}
122  */
123 #endif
124 
CRYSError_t CRYS_HKDF_KeyDerivFunc(CRYS_HKDF_HASH_OpMode_t HKDFhashMode, uint8_t *Salt_ptr, size_t SaltLen, uint8_t *Ikm_ptr, uint32_t IkmLen, uint8_t *Info, uint32_t InfoLen, uint8_t *Okm, uint32_t OkmLen, SaSiBool IsStrongKey)
CRYS_HKDF_KeyDerivFunc performs the HMAC-based key derivation, according to RFC5869.
SaSiBool
Definition: ssi_pal_types.h:50
CRYS_HKDF_HASH_OpMode_t
Definition: crys_hkdf.h:65
This file contains all of the enums and definitions that are used for the CRYS HASH APIs...
uint32_t CRYSError_t
Definition: crys_error.h:253
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.