Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:15

0001 /* nist-keywrap.h
0002 
0003    AES Key Wrap function.
0004    implements RFC 3394
0005    https://tools.ietf.org/html/rfc3394
0006 
0007    Copyright (C) 2021 Nicolas Mora
0008                  2021 Niels Möller
0009 
0010    This file is part of GNU Nettle.
0011 
0012    GNU Nettle is free software: you can redistribute it and/or
0013    modify it under the terms of either:
0014 
0015      * the GNU Lesser General Public License as published by the Free
0016        Software Foundation; either version 3 of the License, or (at your
0017        option) any later version.
0018 
0019    or
0020 
0021      * the GNU General Public License as published by the Free
0022        Software Foundation; either version 2 of the License, or (at your
0023        option) any later version.
0024 
0025    or both in parallel, as here.
0026 
0027    GNU Nettle is distributed in the hope that it will be useful,
0028    but WITHOUT ANY WARRANTY; without even the implied warranty of
0029    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0030    General Public License for more details.
0031 
0032    You should have received copies of the GNU General Public License and
0033    the GNU Lesser General Public License along with this program.  If
0034    not, see http://www.gnu.org/licenses/.
0035 */
0036 
0037 #ifndef NETTLE_NIST_KEYWRAP_H_INCLUDED
0038 #define NETTLE_NIST_KEYWRAP_H_INCLUDED
0039 
0040 #include "nettle-types.h"
0041 #include "aes.h"
0042 
0043 #ifdef __cplusplus
0044 extern "C" {
0045 #endif
0046 
0047 /* Name mangling */
0048 #define nist_keywrap16 nettle_nist_keywrap16
0049 #define nist_keyunwrap16 nettle_nist_keyunwrap16
0050 #define aes128_keywrap nettle_aes128_keywrap
0051 #define aes192_keywrap nettle_aes192_keywrap
0052 #define aes256_keywrap nettle_aes256_keywrap
0053 #define aes128_keyunwrap nettle_aes128_keyunwrap
0054 #define aes192_keyunwrap nettle_aes192_keyunwrap
0055 #define aes256_keyunwrap nettle_aes256_keyunwrap
0056 
0057 void
0058 nist_keywrap16 (const void *ctx, nettle_cipher_func *encrypt,
0059         const uint8_t *iv, size_t ciphertext_length,
0060         uint8_t *ciphertext, const uint8_t *cleartext);
0061 
0062 int
0063 nist_keyunwrap16 (const void *ctx, nettle_cipher_func *decrypt,
0064         const uint8_t *iv, size_t cleartext_length,
0065         uint8_t *cleartext, const uint8_t *ciphertext);
0066 
0067 void
0068 aes128_keywrap (struct aes128_ctx *ctx,
0069         const uint8_t *iv, size_t ciphertext_length,
0070         uint8_t *ciphertext, const uint8_t *cleartext);
0071 
0072 void
0073 aes192_keywrap (struct aes192_ctx *ctx,
0074         const uint8_t *iv, size_t ciphertext_length,
0075         uint8_t *ciphertext, const uint8_t *cleartext);
0076 
0077 void
0078 aes256_keywrap (struct aes256_ctx *ctx,
0079         const uint8_t *iv, size_t ciphertext_length,
0080         uint8_t *ciphertext, const uint8_t *cleartext);
0081 
0082 int
0083 aes128_keyunwrap (struct aes128_ctx *ctx,
0084           const uint8_t *iv, size_t cleartext_length,
0085           uint8_t *cleartext, const uint8_t *ciphertext);
0086 
0087 int
0088 aes192_keyunwrap (struct aes192_ctx *ctx,
0089           const uint8_t *iv, size_t cleartext_length,
0090           uint8_t *cleartext, const uint8_t *ciphertext);
0091 
0092 int
0093 aes256_keyunwrap (struct aes256_ctx *ctx,
0094           const uint8_t *iv, size_t cleartext_length,
0095           uint8_t *cleartext, const uint8_t *ciphertext);
0096 
0097 #ifdef __cplusplus
0098 }
0099 #endif
0100 
0101 #endif              /* NETTLE_NIST_KEYWRAP_H_INCLUDED */