Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 09:29:58

0001 /*
0002  * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
0003  *
0004  * Licensed under the Apache License 2.0 (the "License").  You may not use
0005  * this file except in compliance with the License.  You can obtain a copy
0006  * in the file LICENSE in the source distribution or at
0007  * https://www.openssl.org/source/license.html
0008  */
0009 
0010 #ifndef OPENSSL_AES_H
0011 #define OPENSSL_AES_H
0012 #pragma once
0013 
0014 #include <openssl/macros.h>
0015 #ifndef OPENSSL_NO_DEPRECATED_3_0
0016 #define HEADER_AES_H
0017 #endif
0018 
0019 #include <openssl/opensslconf.h>
0020 
0021 #include <stddef.h>
0022 #ifdef __cplusplus
0023 extern "C" {
0024 #endif
0025 
0026 #define AES_BLOCK_SIZE 16
0027 
0028 #ifndef OPENSSL_NO_DEPRECATED_3_0
0029 
0030 #define AES_ENCRYPT 1
0031 #define AES_DECRYPT 0
0032 
0033 #define AES_MAXNR 14
0034 
0035 /* This should be a hidden type, but EVP requires that the size be known */
0036 struct aes_key_st {
0037 #ifdef AES_LONG
0038     unsigned long rd_key[4 * (AES_MAXNR + 1)];
0039 #else
0040     unsigned int rd_key[4 * (AES_MAXNR + 1)];
0041 #endif
0042     int rounds;
0043 };
0044 typedef struct aes_key_st AES_KEY;
0045 
0046 #endif
0047 #ifndef OPENSSL_NO_DEPRECATED_3_0
0048 OSSL_DEPRECATEDIN_3_0 const char *AES_options(void);
0049 OSSL_DEPRECATEDIN_3_0
0050 int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
0051     AES_KEY *key);
0052 OSSL_DEPRECATEDIN_3_0
0053 int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
0054     AES_KEY *key);
0055 OSSL_DEPRECATEDIN_3_0
0056 void AES_encrypt(const unsigned char *in, unsigned char *out,
0057     const AES_KEY *key);
0058 OSSL_DEPRECATEDIN_3_0
0059 void AES_decrypt(const unsigned char *in, unsigned char *out,
0060     const AES_KEY *key);
0061 OSSL_DEPRECATEDIN_3_0
0062 void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
0063     const AES_KEY *key, const int enc);
0064 OSSL_DEPRECATEDIN_3_0
0065 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
0066     size_t length, const AES_KEY *key,
0067     unsigned char *ivec, const int enc);
0068 OSSL_DEPRECATEDIN_3_0
0069 void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
0070     size_t length, const AES_KEY *key,
0071     unsigned char *ivec, int *num, const int enc);
0072 OSSL_DEPRECATEDIN_3_0
0073 void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
0074     size_t length, const AES_KEY *key,
0075     unsigned char *ivec, int *num, const int enc);
0076 OSSL_DEPRECATEDIN_3_0
0077 void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
0078     size_t length, const AES_KEY *key,
0079     unsigned char *ivec, int *num, const int enc);
0080 OSSL_DEPRECATEDIN_3_0
0081 void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
0082     size_t length, const AES_KEY *key,
0083     unsigned char *ivec, int *num);
0084 
0085 /* NB: the IV is _two_ blocks long */
0086 OSSL_DEPRECATEDIN_3_0
0087 void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
0088     size_t length, const AES_KEY *key,
0089     unsigned char *ivec, const int enc);
0090 /* NB: the IV is _four_ blocks long */
0091 OSSL_DEPRECATEDIN_3_0
0092 void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
0093     size_t length, const AES_KEY *key, const AES_KEY *key2,
0094     const unsigned char *ivec, const int enc);
0095 OSSL_DEPRECATEDIN_3_0
0096 int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
0097     unsigned char *out, const unsigned char *in,
0098     unsigned int inlen);
0099 OSSL_DEPRECATEDIN_3_0
0100 int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
0101     unsigned char *out, const unsigned char *in,
0102     unsigned int inlen);
0103 #endif
0104 
0105 #ifdef __cplusplus
0106 }
0107 #endif
0108 
0109 #endif