kbkdf.h
Go to the documentation of this file.
1 /**
2  * @file kbkdf.h
3  * @brief SP 800-108 key derivation function
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.6.6
29  **/
30 
31 #ifndef _KBKDF_H
32 #define _KBKDF_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 //KBKDF related functions
43 error_t kbkdfCounterHmac(const HashAlgo *hashAlgo, uint_t r, const uint8_t *ki,
44  size_t kiLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko,
45  size_t koLen);
46 
47 error_t kbkdfCounterCmac(const CipherAlgo *cipherAlgo, uint_t r,
48  const uint8_t *ki, size_t kiLen, const uint8_t *fixedData,
49  size_t fixedDataLen, uint8_t *ko, size_t koLen);
50 
51 error_t kbkdfFeedbackHmac(const HashAlgo *hashAlgo, uint_t r, const uint8_t *ki,
52  size_t kiLen, const uint8_t *iv, size_t ivLen, const uint8_t *fixedData,
53  size_t fixedDataLen, uint8_t *ko, size_t koLen);
54 
55 error_t kbkdfFeedbackCmac(const CipherAlgo *cipherAlgo, uint_t r,
56  const uint8_t *ki, size_t kiLen, const uint8_t *iv, size_t ivLen,
57  const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen);
58 
60  const uint8_t *ki, size_t kiLen, const uint8_t *fixedData,
61  size_t fixedDataLen, uint8_t *ko, size_t koLen);
62 
64  const uint8_t *ki, size_t kiLen, const uint8_t *fixedData,
65  size_t fixedDataLen, uint8_t *ko, size_t koLen);
66 
67 error_t kbkdfKmac(uint_t strength, const uint8_t *ki, size_t kiLen,
68  const uint8_t *context, size_t contextLen, const char_t *label,
69  size_t labelLen, uint8_t *ko, size_t koLen);
70 
71 //C++ guard
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif
uint8_t r
Definition: ndp.h:346
error_t
Error codes.
Definition: error.h:43
error_t kbkdfCounterHmac(const HashAlgo *hashAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (counter mode with HMAC)
Definition: kbkdf.c:61
error_t kbkdfKmac(uint_t strength, const uint8_t *ki, size_t kiLen, const uint8_t *context, size_t contextLen, const char_t *label, size_t labelLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (using KMAC)
Definition: kbkdf.c:711
General definitions for cryptographic algorithms.
uint8_t iv[]
Definition: ike.h:1695
error_t kbkdfFeedbackCmac(const CipherAlgo *cipherAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *iv, size_t ivLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (feedback mode with CMAC)
Definition: kbkdf.c:367
char char_t
Definition: compiler_port.h:55
error_t kbkdfDoublePipelineCmac(const CipherAlgo *cipherAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (double-pipeline mode with CMAC)
Definition: kbkdf.c:584
error_t kbkdfFeedbackHmac(const HashAlgo *hashAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *iv, size_t ivLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (feedback mode with HMAC)
Definition: kbkdf.c:262
Common interface for encryption algorithms.
Definition: crypto.h:1285
Common interface for hash algorithms.
Definition: crypto.h:1243
error_t kbkdfDoublePipelineHmac(const HashAlgo *hashAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (double-pipeline mode with HMAC)
Definition: kbkdf.c:478
unsigned int uint_t
Definition: compiler_port.h:57
error_t kbkdfCounterCmac(const CipherAlgo *cipherAlgo, uint_t r, const uint8_t *ki, size_t kiLen, const uint8_t *fixedData, size_t fixedDataLen, uint8_t *ko, size_t koLen)
KBKDF key derivation function (counter mode with CMAC)
Definition: kbkdf.c:157