source: trunk/cscrypt/aes.h@ 11467

Last change on this file since 11467 was 11467, checked in by Gorgone Impertinence, 5 years ago

small cleanup in cscrypt
+ adding libs

thnx to Nautilus7

  • Property svn:eol-style set to LF
File size: 1.5 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 unsigned char *userKey, const int bits,
36 AES_KEY *key);
37int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
38 AES_KEY *key);
39
40void AES_encrypt(const unsigned char *in, unsigned char *out,
41 const AES_KEY *key);
42void AES_decrypt(const unsigned char *in, unsigned char *out,
43 const AES_KEY *key);
44
45void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
46 const unsigned long length, const AES_KEY *key,
47 unsigned char *ivec, const int enc);
48#endif /* !HEADER_AES_H */
49
50#endif
Note: See TracBrowser for help on using the repository browser.