Embedded SDK
Embedded SDK
lcx_pbkdf2.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Ledger Nano S - Secure firmware
4  * (c) 2022 Ledger
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  ********************************************************************************/
18 
29 #ifndef LCX_PBKDF2_H
30 #define LCX_PBKDF2_H
31 
32 #ifdef HAVE_PBKDF2
33 
34 #include "lcx_wrappers.h"
35 #include "lcx_hash.h"
36 
65 // No need to add WARN_UNUSED_RESULT, return value is never checked!
66 cx_err_t cx_pbkdf2_no_throw(cx_md_t md_type,
67  const uint8_t *password,
68  size_t passwordlen,
69  uint8_t *salt,
70  size_t saltlen,
71  uint32_t iterations,
72  uint8_t *out,
73  size_t outLength);
74 
79 DEPRECATED static inline void cx_pbkdf2(cx_md_t md_type,
80  const unsigned char *password,
81  unsigned short passwordlen,
82  unsigned char *salt,
83  unsigned short saltlen,
84  unsigned int iterations,
85  unsigned char *out,
86  unsigned int outLength)
87 {
88  CX_THROW(cx_pbkdf2_no_throw(
89  md_type, password, passwordlen, salt, saltlen, iterations, out, outLength));
90 }
91 
119 #define cx_pbkdf2_sha512(password, password_len, salt, salt_len, iterations, out, out_len) \
120  cx_pbkdf2_no_throw(CX_SHA512, password, password_len, salt, salt_len, iterations, out, out_len)
121 
122 #endif // HAVE_PBKDF2
123 
124 #endif // LCX_PBKDF2_H
Hash functions.
#define CX_THROW(call)
Definition: lcx_wrappers.h:15
unsigned char uint8_t
Definition: usbd_conf.h:53