Mbed TLS v3.6.8
Loading...
Searching...
No Matches
pkcs5.h
Go to the documentation of this file.
1
8/*
9 * Copyright The Mbed TLS Contributors
10 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
11 */
12#ifndef MBEDTLS_PKCS5_H
13#define MBEDTLS_PKCS5_H
14
15#include "mbedtls/build_info.h"
17
18#include "mbedtls/asn1.h"
19#include "mbedtls/md.h"
20#include "mbedtls/cipher.h"
21
22#include <stddef.h>
23#include <stdint.h>
24
26#define MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA -0x2f80
28#define MBEDTLS_ERR_PKCS5_INVALID_FORMAT -0x2f00
30#define MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE -0x2e80
32#define MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH -0x2e00
33
34#define MBEDTLS_PKCS5_DECRYPT MBEDTLS_DECRYPT
35#define MBEDTLS_PKCS5_ENCRYPT MBEDTLS_ENCRYPT
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* Add a default value for MBEDTLS_PK_DECRYPT_MAX_ITERATIONS in case
42 * it's not defined in the user configuration file.
43 * This value is chosen to be valid for almost any real use case and at the
44 * same time be computationally acceptable in terms of execution time.
45 */
46#if !defined(MBEDTLS_PK_DECRYPT_MAX_ITERATIONS)
47#define MBEDTLS_PK_DECRYPT_MAX_ITERATIONS 10000000
48#endif
49
50#if defined(MBEDTLS_ASN1_PARSE_C) && defined(MBEDTLS_CIPHER_C)
51
52#if !defined(MBEDTLS_DEPRECATED_REMOVED)
94 const unsigned char *pwd, size_t pwdlen,
95 const unsigned char *data, size_t datalen,
96 unsigned char *output);
97#endif /* MBEDTLS_DEPRECATED_REMOVED */
98
99#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
100
134int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
135 const unsigned char *pwd, size_t pwdlen,
136 const unsigned char *data, size_t datalen,
137 unsigned char *output, size_t output_size,
138 size_t *output_len);
139
140#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
141
142#endif /* MBEDTLS_ASN1_PARSE_C && MBEDTLS_CIPHER_C*/
143
159 const unsigned char *password,
160 size_t plen, const unsigned char *salt, size_t slen,
161 unsigned int iteration_count,
162 uint32_t key_length, unsigned char *output);
163
164#if defined(MBEDTLS_MD_C)
165#if !defined(MBEDTLS_DEPRECATED_REMOVED)
183 const unsigned char *password,
184 size_t plen,
185 const unsigned char *salt,
186 size_t slen,
187 unsigned int iteration_count,
188 uint32_t key_length,
189 unsigned char *output);
190#endif /* !MBEDTLS_DEPRECATED_REMOVED */
191#endif /* MBEDTLS_MD_C */
192#if defined(MBEDTLS_SELF_TEST)
193
199int mbedtls_pkcs5_self_test(int verbose);
200
201#endif /* MBEDTLS_SELF_TEST */
202
203#ifdef __cplusplus
204}
205#endif
206
207#endif /* pkcs5.h */
Generic ASN.1 parsing.
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
Build-time configuration info.
This file contains the generic functions for message-digest (hashing) and HMAC.
mbedtls_md_type_t
Supported message digests.
Definition md.h:47
int mbedtls_pkcs5_pbkdf2_hmac_ext(mbedtls_md_type_t md_type, const unsigned char *password, size_t plen, const unsigned char *salt, size_t slen, unsigned int iteration_count, uint32_t key_length, unsigned char *output)
PKCS#5 PBKDF2 using HMAC without using the HMAC context.
int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t datalen, unsigned char *output, size_t output_size, size_t *output_len)
PKCS#5 PBES2 function.
int mbedtls_pkcs5_self_test(int verbose)
Checkup routine.
int MBEDTLS_DEPRECATED mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode, const unsigned char *pwd, size_t pwdlen, const unsigned char *data, size_t datalen, unsigned char *output)
PKCS#5 PBES2 function.
int MBEDTLS_DEPRECATED mbedtls_pkcs5_pbkdf2_hmac(mbedtls_md_context_t *ctx, const unsigned char *password, size_t plen, const unsigned char *salt, size_t slen, unsigned int iteration_count, uint32_t key_length, unsigned char *output)
PKCS#5 PBKDF2 using HMAC.
Common and shared functions used by multiple modules in the Mbed TLS library.
#define MBEDTLS_DEPRECATED