source: trunk/cscrypt/aes.h

Last change on this file was 11480, checked in by Gorgone Impertinence, 4 years ago

big update pack 5
another cleanup &
removed duplicate functions

  • Property svn:eol-style set to LF
File size: 1.4 KB
Line 
1#if defined(WITH_SSL) || defined(WITH_LIBCRYPTO)
2# include <openssl/aes.h>
3#else
4#ifndef HEADER_AES_H
5#define HEADER_AES_H
6
7#define AES_ENCRYPT 1
8#define AES_DECRYPT 0
9
10/* Because array size can't be a const in C, the following two are macros.
11 Both sizes are in bytes. */
12#define AES_MAXNR 14
13#define AES_BLOCK_SIZE 16
14
15# define GETU32(pt) (((uint32_t)(pt)[0] << 24) ^ ((uint32_t)(pt)[1] << 16) ^ ((uint32_t)(pt)[2] << 8) ^ ((uint32_t)(pt)[3]))
16# define PUTU32(ct, st) { (ct)[0] = (uint8_t)((st) >> 24); (ct)[1] = (uint8_t)((st) >> 16); (ct)[2] = (uint8_t)((st) >> 8); (ct)[3] = (uint8_t)(st); }
17
18#include <stdint.h>
19
20#define MAXKC (256/32)
21#define MAXKB (256/8)
22#define MAXNR 14
23
24/* This controls loop-unrolling in aes_core.c */
25#undef FULL_UNROLL
26
27/* This should be a hidden type, but EVP requires that the size be known */
28struct aes_key_st
29{
30 uint32_t rd_key[4 * (AES_MAXNR + 1)];
31 int rounds;
32};
33typedef struct aes_key_st AES_KEY;
34
35int AES_set_encrypt_key(const uint8_t *userKey, const int bits, AES_KEY *key);
36int AES_set_decrypt_key(const uint8_t *userKey, const int bits, AES_KEY *key);
37
38void AES_encrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key);
39void AES_decrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key);
40
41void AES_cbc_encrypt(const uint8_t *in, uint8_t *out, const unsigned long length,
42 const AES_KEY *key, uint8_t *ivec, const int enc);
43#endif /* !HEADER_AES_H */
44
45#endif
Note: See TracBrowser for help on using the repository browser.