00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef HEADER_AES_H
00053 #define HEADER_AES_H
00054
00055 #include <openssl/opensslconf.h>
00056
00057 #ifdef OPENSSL_NO_AES
00058 #error AES is disabled.
00059 #endif
00060
00061 #define AES_ENCRYPT 1
00062 #define AES_DECRYPT 0
00063
00064
00065
00066 #define AES_MAXNR 14
00067 #define AES_BLOCK_SIZE 16
00068
00069 #ifdef __cplusplus
00070 extern "C" {
00071 #endif
00072
00073
00074 struct aes_key_st {
00075 #ifdef AES_LONG
00076 unsigned long rd_key[4 *(AES_MAXNR + 1)];
00077 #else
00078 unsigned int rd_key[4 *(AES_MAXNR + 1)];
00079 #endif
00080 int rounds;
00081 };
00082 typedef struct aes_key_st AES_KEY;
00083
00084 const char *AES_options(void);
00085
00086 int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
00087 AES_KEY *key);
00088 int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
00089 AES_KEY *key);
00090
00091 void AES_encrypt(const unsigned char *in, unsigned char *out,
00092 const AES_KEY *key);
00093 void AES_decrypt(const unsigned char *in, unsigned char *out,
00094 const AES_KEY *key);
00095
00096 void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
00097 const AES_KEY *key, const int enc);
00098 void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
00099 const unsigned long length, const AES_KEY *key,
00100 unsigned char *ivec, const int enc);
00101 void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
00102 const unsigned long length, const AES_KEY *key,
00103 unsigned char *ivec, int *num, const int enc);
00104 void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
00105 const unsigned long length, const AES_KEY *key,
00106 unsigned char *ivec, int *num, const int enc);
00107 void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
00108 const unsigned long length, const AES_KEY *key,
00109 unsigned char *ivec, int *num, const int enc);
00110 void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
00111 const int nbits,const AES_KEY *key,
00112 unsigned char *ivec,const int enc);
00113 void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
00114 const unsigned long length, const AES_KEY *key,
00115 unsigned char *ivec, int *num);
00116 void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
00117 const unsigned long length, const AES_KEY *key,
00118 unsigned char ivec[AES_BLOCK_SIZE],
00119 unsigned char ecount_buf[AES_BLOCK_SIZE],
00120 unsigned int *num);
00121
00122
00123
00124 void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
00125 const unsigned long length, const AES_KEY *key,
00126 unsigned char *ivec, const int enc);
00127
00128 void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
00129 const unsigned long length, const AES_KEY *key,
00130 const AES_KEY *key2, const unsigned char *ivec,
00131 const int enc);
00132
00133
00134 #ifdef __cplusplus
00135 }
00136 #endif
00137
00138 #endif