AES-NI backport from HEAD. Note that e_aes.c doesn't implement all modes
[openssl.git] / crypto / modes / modes.h
1 /* ====================================================================
2  * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
3  *
4  * Rights for redistribution and usage in source and binary
5  * forms are granted according to the OpenSSL license.
6  */
7
8 #include <stddef.h>
9
10 typedef void (*block128_f)(const unsigned char in[16],
11                         unsigned char out[16],
12                         const void *key);
13
14 typedef void (*cbc128_f)(const unsigned char *in, unsigned char *out,
15                         size_t len, const void *key,
16                         unsigned char ivec[16], int enc);
17
18 typedef void (*ctr128_f)(const unsigned char *in, unsigned char *out,
19                         size_t blocks, const void *key,
20                         const unsigned char ivec[16]);
21
22 void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
23                         size_t len, const void *key,
24                         unsigned char ivec[16], block128_f block);
25 void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
26                         size_t len, const void *key,
27                         unsigned char ivec[16], block128_f block);
28
29 void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
30                         size_t len, const void *key,
31                         unsigned char ivec[16], unsigned char ecount_buf[16],
32                         unsigned int *num, block128_f block);
33
34 void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
35                         size_t len, const void *key,
36                         unsigned char ivec[16], unsigned char ecount_buf[16],
37                         unsigned int *num, ctr128_f ctr);
38
39 void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
40                         size_t len, const void *key,
41                         unsigned char ivec[16], int *num,
42                         block128_f block);
43
44 void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
45                         size_t len, const void *key,
46                         unsigned char ivec[16], int *num,
47                         int enc, block128_f block);
48 void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
49                         size_t length, const void *key,
50                         unsigned char ivec[16], int *num,
51                         int enc, block128_f block);
52 void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
53                         size_t bits, const void *key,
54                         unsigned char ivec[16], int *num,
55                         int enc, block128_f block);
56
57 size_t CRYPTO_cts128_encrypt_block(const unsigned char *in, unsigned char *out,
58                         size_t len, const void *key,
59                         unsigned char ivec[16], block128_f block);
60 size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
61                         size_t len, const void *key,
62                         unsigned char ivec[16], cbc128_f cbc);
63 size_t CRYPTO_cts128_decrypt_block(const unsigned char *in, unsigned char *out,
64                         size_t len, const void *key,
65                         unsigned char ivec[16], block128_f block);
66 size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
67                         size_t len, const void *key,
68                         unsigned char ivec[16], cbc128_f cbc);