]> git.ipfire.org Git - thirdparty/openssl.git/blame - include/openssl/aes.h
Deprecate the AES_ige_*() functions
[thirdparty/openssl.git] / include / openssl / aes.h
CommitLineData
21dcbebc
RS
1/*
2 * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
6f9079fd 3 *
48f4ad77 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
21dcbebc
RS
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
6f9079fd
RL
8 */
9
ae4186b0
DMSP
10#ifndef OPENSSL_AES_H
11# define OPENSSL_AES_H
d86167ec
DMSP
12# pragma once
13
14# include <openssl/macros.h>
936c2b9e 15# ifndef OPENSSL_NO_DEPRECATED_3_0
d86167ec
DMSP
16# define HEADER_AES_H
17# endif
6f9079fd 18
0f113f3e 19# include <openssl/opensslconf.h>
940767b0 20
0f113f3e 21# include <stddef.h>
3c27208f
RS
22# ifdef __cplusplus
23extern "C" {
24# endif
f768be81 25
0f113f3e
MC
26# define AES_ENCRYPT 1
27# define AES_DECRYPT 0
aa18245f 28
0f113f3e
MC
29/*
30 * Because array size can't be a const in C, the following two are macros.
31 * Both sizes are in bytes.
32 */
33# define AES_MAXNR 14
34# define AES_BLOCK_SIZE 16
6f9079fd 35
6f9079fd
RL
36/* This should be a hidden type, but EVP requires that the size be known */
37struct aes_key_st {
0f113f3e
MC
38# ifdef AES_LONG
39 unsigned long rd_key[4 * (AES_MAXNR + 1)];
40# else
41 unsigned int rd_key[4 * (AES_MAXNR + 1)];
42# endif
6f9079fd
RL
43 int rounds;
44};
45typedef struct aes_key_st AES_KEY;
46
47const char *AES_options(void);
48
97879bcd 49int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
0f113f3e 50 AES_KEY *key);
97879bcd 51int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
0f113f3e 52 AES_KEY *key);
6f9079fd 53
97879bcd 54void AES_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e 55 const AES_KEY *key);
97879bcd 56void AES_decrypt(const unsigned char *in, unsigned char *out,
0f113f3e 57 const AES_KEY *key);
6f9079fd
RL
58
59void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e 60 const AES_KEY *key, const int enc);
6f9079fd 61void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
62 size_t length, const AES_KEY *key,
63 unsigned char *ivec, const int enc);
97879bcd 64void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
65 size_t length, const AES_KEY *key,
66 unsigned char *ivec, int *num, const int enc);
8d1ebe0b 67void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
68 size_t length, const AES_KEY *key,
69 unsigned char *ivec, int *num, const int enc);
8d1ebe0b 70void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
71 size_t length, const AES_KEY *key,
72 unsigned char *ivec, int *num, const int enc);
97879bcd 73void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
0f113f3e
MC
74 size_t length, const AES_KEY *key,
75 unsigned char *ivec, int *num);
7573fe1a 76
aa6d1a0c 77/* NB: the IV is _two_ blocks long */
7573fe1a
MC
78DEPRECATEDIN_3_0(void
79 AES_ige_encrypt(const unsigned char *in, unsigned char *out,
80 size_t length, const AES_KEY *key,
81 unsigned char *ivec, const int enc))
aa6d1a0c 82/* NB: the IV is _four_ blocks long */
7573fe1a
MC
83DEPRECATEDIN_3_0(void
84 AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
85 size_t length, const AES_KEY *key,
86 const AES_KEY *key2,
87 const unsigned char *ivec, const int enc))
97879bcd 88
6e3bc4f0 89int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
0f113f3e
MC
90 unsigned char *out,
91 const unsigned char *in, unsigned int inlen);
6e3bc4f0 92int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
0f113f3e
MC
93 unsigned char *out,
94 const unsigned char *in, unsigned int inlen);
6e3bc4f0 95
6f9079fd 96
3c27208f 97# ifdef __cplusplus
6f9079fd 98}
3c27208f 99# endif
6f9079fd 100
3c27208f 101#endif