mbed TLS v2.28.2
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
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License"); you may
23 * not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
30 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 */
34
35#ifndef MBEDTLS_NIST_KW_H
36#define MBEDTLS_NIST_KW_H
37
38#if !defined(MBEDTLS_CONFIG_FILE)
39#include "mbedtls/config.h"
40#else
41#include MBEDTLS_CONFIG_FILE
42#endif
43
44#include "mbedtls/cipher.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50typedef enum
51{
55
56#if !defined(MBEDTLS_NIST_KW_ALT)
57// Regular implementation
58//
59
67typedef struct {
70
71#else /* MBEDTLS_NIST_key wrapping_ALT */
72#include "nist_kw_alt.h"
73#endif /* MBEDTLS_NIST_KW_ALT */
74
84
102 mbedtls_cipher_id_t cipher,
103 const unsigned char *key,
104 unsigned int keybits,
105 const int is_wrap );
106
114
137 const unsigned char *input, size_t in_len,
138 unsigned char *output, size_t* out_len, size_t out_size );
139
164 const unsigned char *input, size_t in_len,
165 unsigned char *output, size_t* out_len, size_t out_size);
166
167
168#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
175int mbedtls_nist_kw_self_test( int verbose );
176#endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
177
178#ifdef __cplusplus
179}
180#endif
181
182#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:90
Configuration options (set of defines)
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:51
@ MBEDTLS_KW_MODE_KW
Definition: nist_kw.h:52
@ MBEDTLS_KW_MODE_KWP
Definition: nist_kw.h:53
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...
The key wrapping context-type definition. The key wrapping context is passed to the APIs called.
Definition: nist_kw.h:67
mbedtls_cipher_context_t cipher_ctx
Definition: nist_kw.h:68