]>
Commit | Line | Data |
---|---|---|
21dcbebc | 1 | /* |
33388b44 | 2 | * Copyright 2002-2020 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 |
23 | extern "C" { | |
24 | # endif | |
f768be81 | 25 | |
0f113f3e | 26 | # define AES_BLOCK_SIZE 16 |
6f9079fd | 27 | |
c72fa255 MC |
28 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
29 | ||
30 | # define AES_ENCRYPT 1 | |
31 | # define AES_DECRYPT 0 | |
32 | ||
33 | # define AES_MAXNR 14 | |
34 | ||
35 | ||
6f9079fd RL |
36 | /* This should be a hidden type, but EVP requires that the size be known */ |
37 | struct aes_key_st { | |
c72fa255 | 38 | # ifdef AES_LONG |
0f113f3e | 39 | unsigned long rd_key[4 * (AES_MAXNR + 1)]; |
c72fa255 | 40 | # else |
0f113f3e | 41 | unsigned int rd_key[4 * (AES_MAXNR + 1)]; |
c72fa255 | 42 | # endif |
6f9079fd RL |
43 | int rounds; |
44 | }; | |
45 | typedef struct aes_key_st AES_KEY; | |
46 | ||
c72fa255 | 47 | # endif |
0016a034 RL |
48 | # ifndef OPENSSL_NO_DEPRECATED_3_0 |
49 | OSSL_DEPRECATEDIN_3_0 const char *AES_options(void); | |
50 | OSSL_DEPRECATEDIN_3_0 | |
51 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, | |
52 | AES_KEY *key); | |
53 | OSSL_DEPRECATEDIN_3_0 | |
54 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, | |
55 | AES_KEY *key); | |
56 | OSSL_DEPRECATEDIN_3_0 | |
57 | void AES_encrypt(const unsigned char *in, unsigned char *out, | |
58 | const AES_KEY *key); | |
59 | OSSL_DEPRECATEDIN_3_0 | |
60 | void AES_decrypt(const unsigned char *in, unsigned char *out, | |
61 | const AES_KEY *key); | |
62 | OSSL_DEPRECATEDIN_3_0 | |
63 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, | |
64 | const AES_KEY *key, const int enc); | |
65 | OSSL_DEPRECATEDIN_3_0 | |
66 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, | |
67 | size_t length, const AES_KEY *key, | |
68 | unsigned char *ivec, const int enc); | |
69 | OSSL_DEPRECATEDIN_3_0 | |
70 | void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, | |
71 | size_t length, const AES_KEY *key, | |
72 | unsigned char *ivec, int *num, const int enc); | |
73 | OSSL_DEPRECATEDIN_3_0 | |
74 | void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, | |
75 | size_t length, const AES_KEY *key, | |
76 | unsigned char *ivec, int *num, const int enc); | |
77 | OSSL_DEPRECATEDIN_3_0 | |
78 | void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, | |
79 | size_t length, const AES_KEY *key, | |
80 | unsigned char *ivec, int *num, const int enc); | |
81 | OSSL_DEPRECATEDIN_3_0 | |
82 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, | |
83 | size_t length, const AES_KEY *key, | |
84 | unsigned char *ivec, int *num); | |
7573fe1a | 85 | |
aa6d1a0c | 86 | /* NB: the IV is _two_ blocks long */ |
0016a034 RL |
87 | OSSL_DEPRECATEDIN_3_0 |
88 | void AES_ige_encrypt(const unsigned char *in, unsigned char *out, | |
89 | size_t length, const AES_KEY *key, | |
90 | unsigned char *ivec, const int enc); | |
aa6d1a0c | 91 | /* NB: the IV is _four_ blocks long */ |
0016a034 RL |
92 | OSSL_DEPRECATEDIN_3_0 |
93 | void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, | |
94 | size_t length, const AES_KEY *key, const AES_KEY *key2, | |
95 | const unsigned char *ivec, const int enc); | |
96 | OSSL_DEPRECATEDIN_3_0 | |
97 | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, | |
98 | unsigned char *out, const unsigned char *in, | |
99 | unsigned int inlen); | |
100 | OSSL_DEPRECATEDIN_3_0 | |
101 | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, | |
102 | unsigned char *out, const unsigned char *in, | |
103 | unsigned int inlen); | |
104 | # endif | |
6e3bc4f0 | 105 | |
6f9079fd | 106 | |
3c27208f | 107 | # ifdef __cplusplus |
6f9079fd | 108 | } |
3c27208f | 109 | # endif |
6f9079fd | 110 | |
3c27208f | 111 | #endif |