Mbed TLS v2.28.9
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 
26 #if !defined(MBEDTLS_CONFIG_FILE)
27 #include "mbedtls/config.h"
28 #else
29 #include MBEDTLS_CONFIG_FILE
30 #endif
31 
32 #include "mbedtls/cipher.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 typedef enum {
42 
43 #if !defined(MBEDTLS_NIST_KW_ALT)
44 // Regular implementation
45 //
46 
54 typedef struct {
57 
58 #else /* MBEDTLS_NIST_key wrapping_ALT */
59 #include "nist_kw_alt.h"
60 #endif /* MBEDTLS_NIST_KW_ALT */
61 
71 
89  mbedtls_cipher_id_t cipher,
90  const unsigned char *key,
91  unsigned int keybits,
92  const int is_wrap);
93 
101 
124  const unsigned char *input, size_t in_len,
125  unsigned char *output, size_t *out_len, size_t out_size);
126 
151  const unsigned char *input, size_t in_len,
152  unsigned char *output, size_t *out_len, size_t out_size);
153 
154 
155 #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
156 
162 int mbedtls_nist_kw_self_test(int verbose);
163 #endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
164 
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif /* MBEDTLS_NIST_KW_H */
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.
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...
The key wrapping context-type definition. The key wrapping context is passed to the APIs called...
Definition: nist_kw.h:54
int mbedtls_nist_kw_self_test(int verbose)
The key wrapping checkup routine.
Configuration options (set of defines)
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:38
mbedtls_cipher_id_t
Supported cipher types.
Definition: cipher.h:78
This file contains an abstraction interface for use with the cipher primitives provided by the librar...
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...
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...
mbedtls_cipher_context_t cipher_ctx
Definition: nist_kw.h:55