pbkdf.h
Go to the documentation of this file.
1 /**
2  * @file pbkdf.h
3  * @brief PBKDF (Password-Based 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 _PBKDF_H
32 #define _PBKDF_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 
43 /**
44  * @brief PBKDF2 pseudorandom functions
45  **/
46 
47 typedef enum
48 {
52 
53 
54 //PBKDF related constants
55 extern const uint8_t PBKDF2_OID[9];
56 
57 //PBKDF related functions
58 error_t pbkdf1(const HashAlgo *hashAlgo, const uint8_t *p, size_t pLen,
59  const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen);
60 
61 error_t pbkdf2(Pbkdf2Type type, const HashAlgo *hashAlgo, const uint8_t *p,
62  size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk,
63  size_t dkLen);
64 
65 error_t pbkdf2Hmac(const HashAlgo *hashAlgo, const uint8_t *p, size_t pLen,
66  const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen);
67 
68 error_t pbkdf2AesCmacPrf128(const uint8_t *p, size_t pLen, const uint8_t *s,
69  size_t sLen, uint_t c, uint8_t *dk, size_t dkLen);
70 
71 //C++ guard
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif
const uint8_t PBKDF2_OID[9]
Definition: pbkdf.c:43
Pbkdf2Type
PBKDF2 pseudorandom functions.
Definition: pbkdf.h:48
uint8_t p
Definition: ndp.h:300
error_t pbkdf2(Pbkdf2Type type, const HashAlgo *hashAlgo, const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF2 key derivation function.
Definition: pbkdf.c:141
@ PBKDF2_TYPE_HMAC
Definition: pbkdf.h:49
uint8_t type
Definition: coap_common.h:176
error_t pbkdf2AesCmacPrf128(const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF2 key derivation function (with AES-CMAC-PRF-128)
Definition: pbkdf.c:277
error_t pbkdf2Hmac(const HashAlgo *hashAlgo, const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF2 key derivation function (with HMAC)
Definition: pbkdf.c:179
error_t
Error codes.
Definition: error.h:43
General definitions for cryptographic algorithms.
uint8_t s
Definition: igmp_common.h:234
Common interface for hash algorithms.
Definition: crypto.h:1243
unsigned int uint_t
Definition: compiler_port.h:57
@ PBKDF2_TYPE_AES_CMAC_PRF_128
Definition: pbkdf.h:50
error_t pbkdf1(const HashAlgo *hashAlgo, const uint8_t *p, size_t pLen, const uint8_t *s, size_t sLen, uint_t c, uint8_t *dk, size_t dkLen)
PBKDF1 key derivation function.
Definition: pbkdf.c:64
uint8_t c
Definition: ndp.h:514