Mbed TLS v3.6.0
nist_kw.h
Go to the documentation of this file.
1 
18 /*
19  * Copyright The Mbed TLS Contributors
20  * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
21  */
22 
23 #ifndef MBEDTLS_NIST_KW_H
24 #define MBEDTLS_NIST_KW_H
25 #include "mbedtls/private_access.h"
26 
27 #include "mbedtls/build_info.h"
28 
29 #include "mbedtls/cipher.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 typedef enum {
39 
40 #if !defined(MBEDTLS_NIST_KW_ALT)
41 // Regular implementation
42 //
43 
51 typedef struct {
54 
55 #else /* MBEDTLS_NIST_key wrapping_ALT */
56 #include "nist_kw_alt.h"
57 #endif /* MBEDTLS_NIST_KW_ALT */
58 
68 
86  mbedtls_cipher_id_t cipher,
87  const unsigned char *key,
88  unsigned int keybits,
89  const int is_wrap);
90 
98 
121  const unsigned char *input, size_t in_len,
122  unsigned char *output, size_t *out_len, size_t out_size);
123 
148  const unsigned char *input, size_t in_len,
149  unsigned char *output, size_t *out_len, size_t out_size);
150 
151 
152 #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
159 int mbedtls_nist_kw_self_test(int verbose);
160 #endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif /* MBEDTLS_NIST_KW_H */
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
mbedtls_cipher_id_t
Supported cipher types.
Definition: cipher.h:66
Build-time configuration info.
int mbedtls_nist_kw_setkey(mbedtls_nist_kw_context *ctx, mbedtls_cipher_id_t cipher, const unsigned char *key, unsigned int keybits, const int is_wrap)
This function initializes the key wrapping context set in the ctx parameter and sets the encryption k...
int mbedtls_nist_kw_wrap(mbedtls_nist_kw_context *ctx, mbedtls_nist_kw_mode_t mode, const unsigned char *input, size_t in_len, unsigned char *output, size_t *out_len, size_t out_size)
This function encrypts a buffer using key wrapping.
int mbedtls_nist_kw_unwrap(mbedtls_nist_kw_context *ctx, mbedtls_nist_kw_mode_t mode, const unsigned char *input, size_t in_len, unsigned char *output, size_t *out_len, size_t out_size)
This function decrypts a buffer using key wrapping.
mbedtls_nist_kw_mode_t
Definition: nist_kw.h:35
@ MBEDTLS_KW_MODE_KW
Definition: nist_kw.h:36
@ MBEDTLS_KW_MODE_KWP
Definition: nist_kw.h:37
void mbedtls_nist_kw_free(mbedtls_nist_kw_context *ctx)
This function releases and clears the specified key wrapping context and underlying cipher sub-contex...
int mbedtls_nist_kw_self_test(int verbose)
The key wrapping checkup routine.
void mbedtls_nist_kw_init(mbedtls_nist_kw_context *ctx)
This function initializes the specified key wrapping context to make references valid and prepare the...
Macro wrapper for struct's members.
#define MBEDTLS_PRIVATE(member)
The key wrapping context-type definition. The key wrapping context is passed to the APIs called.
Definition: nist_kw.h:51