mbed TLS v2.16.1
nist_kw.h
Go to the documentation of this file.
1 
18 /*
19  * Copyright (C) 2018, Arm Limited (or its affiliates), All Rights Reserved
20  * SPDX-License-Identifier: GPL-2.0
21  *
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License as published by
24  * the Free Software Foundation; either version 2 of the License, or
25  * (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License along
33  * with this program; if not, write to the Free Software Foundation, Inc.,
34  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35  *
36  * This file is part of Mbed TLS (https://tls.mbed.org)
37  */
38 
39 #ifndef MBEDTLS_NIST_KW_H
40 #define MBEDTLS_NIST_KW_H
41 
42 #if !defined(MBEDTLS_CONFIG_FILE)
43 #include "config.h"
44 #else
45 #include MBEDTLS_CONFIG_FILE
46 #endif
47 
48 #include "cipher.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 typedef enum
55 {
59 
60 #if !defined(MBEDTLS_NIST_KW_ALT)
61 // Regular implementation
62 //
63 
71 typedef struct {
74 
75 #else /* MBEDTLS_NIST_key wrapping_ALT */
76 #include "nist_kw_alt.h"
77 #endif /* MBEDTLS_NIST_KW_ALT */
78 
88 
106  mbedtls_cipher_id_t cipher,
107  const unsigned char *key,
108  unsigned int keybits,
109  const int is_wrap );
110 
118 
141  const unsigned char *input, size_t in_len,
142  unsigned char *output, size_t* out_len, size_t out_size );
143 
168  const unsigned char *input, size_t in_len,
169  unsigned char *output, size_t* out_len, size_t out_size);
170 
171 
172 #if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_AES_C)
173 
179 int mbedtls_nist_kw_self_test( int verbose );
180 #endif /* MBEDTLS_SELF_TEST && MBEDTLS_AES_C */
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #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:71
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:54
mbedtls_cipher_id_t
Supported cipher types.
Definition: cipher.h:86
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:72