aes.h
Go to the documentation of this file.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
#ifndef _AES_H
00038
#define _AES_H
00039
00040
00041
#include "limits.h"
00042
00043
#if defined(__cplusplus)
00044
extern "C"
00045 {
00046
#endif
00047
00048 #define AES_128
00049
#undef AES_192
00050
#undef AES_256
00051
#undef AES_VAR
00052
00053
00054
00055 #define AES_ENCRYPT
00056 #define AES_DECRYPT
00057 #define AES_ERR_CHK
00058
00059
#if UCHAR_MAX == 0xff
00060
typedef unsigned char aes_08t;
00061
#else
00062
#error Please define aes_08t as an 8-bit unsigned integer type in aes.h
00063
#endif
00064
00065
#if UINT_MAX == 0xffffffff
00066
typedef unsigned int aes_32t;
00067
#elif ULONG_MAX == 0xffffffff
00068
typedef unsigned long aes_32t;
00069
#else
00070
#error Please define aes_32t as a 32-bit unsigned integer type in aes.h
00071
#endif
00072
00073 #define AES_BLOCK_SIZE 16
00074 #define N_COLS 4
00075
00076
00077
00078
00079
00080 #define KS_LENGTH 64
00081
00082
#ifdef AES_ERR_CHK
00083 #define aes_ret int
00084 #define aes_good 0
00085 #define aes_error -1
00086
#else
00087
#define aes_ret void
00088
#endif
00089
00090
#ifndef AES_DLL
00091 #define aes_rval aes_ret
00092
#else
00093
#define aes_rval aes_ret __declspec(dllexport) _stdcall
00094
#endif
00095
00096
00097
00098
00099
void gen_tabs(
void);
00100
00101
00102
00103
00104
#ifdef AES_ENCRYPT
00105
00106 typedef struct
00107 { aes_32t ks[
KS_LENGTH];
00108 }
aes_encrypt_ctx;
00109
00110
#if defined(AES_128) || defined(AES_VAR)
00111
aes_rval aes_encrypt_key128(
const void *in_key,
aes_encrypt_ctx cx[1]);
00112
#endif
00113
00114
#if defined(AES_192) || defined(AES_VAR)
00115
aes_rval aes_encrypt_key192(
const void *in_key,
aes_encrypt_ctx cx[1]);
00116
#endif
00117
00118
#if defined(AES_256) || defined(AES_VAR)
00119
aes_rval aes_encrypt_key256(
const void *in_key,
aes_encrypt_ctx cx[1]);
00120
#endif
00121
00122
#if defined(AES_VAR)
00123
aes_rval aes_encrypt_key(
const void *in_key,
int key_len,
aes_encrypt_ctx cx[1]);
00124
#endif
00125
00126
aes_rval aes_encrypt(
const void *in_blk,
void *out_blk,
const aes_encrypt_ctx cx[1]);
00127
#endif
00128
00129
#ifdef AES_DECRYPT
00130
00131 typedef struct
00132 { aes_32t ks[
KS_LENGTH];
00133 }
aes_decrypt_ctx;
00134
00135
#if defined(AES_128) || defined(AES_VAR)
00136
aes_rval aes_decrypt_key128(
const void *in_key,
aes_decrypt_ctx cx[1]);
00137
#endif
00138
00139
#if defined(AES_192) || defined(AES_VAR)
00140
aes_rval aes_decrypt_key192(
const void *in_key,
aes_decrypt_ctx cx[1]);
00141
#endif
00142
00143
#if defined(AES_256) || defined(AES_VAR)
00144
aes_rval aes_decrypt_key256(
const void *in_key,
aes_decrypt_ctx cx[1]);
00145
#endif
00146
00147
#if defined(AES_VAR)
00148
aes_rval aes_decrypt_key(
const void *in_key,
int key_len,
aes_decrypt_ctx cx[1]);
00149
#endif
00150
00151
aes_rval aes_decrypt(
const void *in_blk,
void *out_blk,
const aes_decrypt_ctx cx[1]);
00152
#endif
00153
00154
#if defined(__cplusplus)
00155
}
00156
#endif
00157
00158
#endif
Generated on Sat Jun 12 16:40:57 2004 for Asterisk by
1.3.7