]> git.ipfire.org Git - thirdparty/nettle.git/blame - nist-keywrap.h
Use NETTLE_OCTET_SIZE_TO_LIMB_SIZE macro.
[thirdparty/nettle.git] / nist-keywrap.h
CommitLineData
0145efbc
NM
1/* nist-keywrap.h
2
3 AES Key Wrap function.
4 implements RFC 3394
5 https://tools.ietf.org/html/rfc3394
6
7 Copyright (C) 2021 Nicolas Mora
8 2021 Niels Möller
9
10 This file is part of GNU Nettle.
11
12 GNU Nettle is free software: you can redistribute it and/or
13 modify it under the terms of either:
14
15 * the GNU Lesser General Public License as published by the Free
16 Software Foundation; either version 3 of the License, or (at your
17 option) any later version.
18
19 or
20
21 * the GNU General Public License as published by the Free
22 Software Foundation; either version 2 of the License, or (at your
23 option) any later version.
24
25 or both in parallel, as here.
26
27 GNU Nettle 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 GNU
30 General Public License for more details.
31
32 You should have received copies of the GNU General Public License and
33 the GNU Lesser General Public License along with this program. If
34 not, see http://www.gnu.org/licenses/.
35*/
36
37#ifndef NETTLE_NIST_KEYWRAP_H_INCLUDED
38#define NETTLE_NIST_KEYWRAP_H_INCLUDED
39
40#include "nettle-types.h"
41#include "aes.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/* Name mangling */
48#define nist_keywrap16 nettle_nist_keywrap16
49#define nist_keyunwrap16 nettle_nist_keyunwrap16
50#define aes128_keywrap nettle_aes128_keywrap
51#define aes192_keywrap nettle_aes192_keywrap
52#define aes256_keywrap nettle_aes256_keywrap
53#define aes128_keyunwrap nettle_aes128_keyunwrap
54#define aes192_keyunwrap nettle_aes192_keyunwrap
55#define aes256_keyunwrap nettle_aes256_keyunwrap
56
57void
58nist_keywrap16 (const void *ctx, nettle_cipher_func *encrypt,
59 const uint8_t *iv, size_t ciphertext_length,
60 uint8_t *ciphertext, const uint8_t *cleartext);
61
62int
63nist_keyunwrap16 (const void *ctx, nettle_cipher_func *decrypt,
64 const uint8_t *iv, size_t cleartext_length,
65 uint8_t *cleartext, const uint8_t *ciphertext);
66
67void
68aes128_keywrap (struct aes128_ctx *ctx,
69 const uint8_t *iv, size_t ciphertext_length,
70 uint8_t *ciphertext, const uint8_t *cleartext);
71
72void
73aes192_keywrap (struct aes192_ctx *ctx,
74 const uint8_t *iv, size_t ciphertext_length,
75 uint8_t *ciphertext, const uint8_t *cleartext);
76
77void
78aes256_keywrap (struct aes256_ctx *ctx,
79 const uint8_t *iv, size_t ciphertext_length,
80 uint8_t *ciphertext, const uint8_t *cleartext);
81
82int
83aes128_keyunwrap (struct aes128_ctx *ctx,
84 const uint8_t *iv, size_t cleartext_length,
85 uint8_t *cleartext, const uint8_t *ciphertext);
86
87int
88aes192_keyunwrap (struct aes192_ctx *ctx,
89 const uint8_t *iv, size_t cleartext_length,
90 uint8_t *cleartext, const uint8_t *ciphertext);
91
92int
93aes256_keyunwrap (struct aes256_ctx *ctx,
94 const uint8_t *iv, size_t cleartext_length,
95 uint8_t *cleartext, const uint8_t *ciphertext);
96
97#ifdef __cplusplus
98}
99#endif
100
101#endif /* NETTLE_NIST_KEYWRAP_H_INCLUDED */