/src/gnutls/lib/accelerated/x86/aes-x86.h
Line | Count | Source (jump to first uncovered line) |
1 | | #ifndef GNUTLS_LIB_ACCELERATED_X86_AES_X86_H |
2 | | # define GNUTLS_LIB_ACCELERATED_X86_AES_X86_H |
3 | | |
4 | | # include "gnutls_int.h" |
5 | | |
6 | | void register_x86_crypto(void); |
7 | | |
8 | | # define ALIGN16(x) \ |
9 | 0 | ((void *)(((ptrdiff_t)(x)+(ptrdiff_t)0x0f)&~((ptrdiff_t)0x0f))) |
10 | | |
11 | | # define AES_KEY_ALIGN_SIZE 4 |
12 | | # define AES_MAXNR 14 |
13 | | typedef struct { |
14 | | /* We add few more integers to allow alignment |
15 | | * on a 16-byte boundary. |
16 | | */ |
17 | | uint32_t rd_key[4 * (AES_MAXNR + 1) + AES_KEY_ALIGN_SIZE]; |
18 | | uint32_t rounds; |
19 | | } AES_KEY; |
20 | | |
21 | | # define CHECK_AES_KEYSIZE(s) \ |
22 | | if (s != 16 && s != 24 && s != 32) \ |
23 | | return GNUTLS_E_INVALID_REQUEST |
24 | | |
25 | | # include <intprops.h> |
26 | 0 | # define AES_GCM_ENCRYPT_MAX_BYTES ((1ULL << 36) - 32) |
27 | | static inline int record_aes_gcm_encrypt_size(size_t *counter, size_t size) |
28 | 0 | { |
29 | 0 | size_t sum; |
30 | |
|
31 | 0 | if (!INT_ADD_OK(*counter, size, &sum) || |
32 | 0 | sum > AES_GCM_ENCRYPT_MAX_BYTES) { |
33 | 0 | return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); |
34 | 0 | } |
35 | 0 | *counter = sum; |
36 | |
|
37 | 0 | return 0; |
38 | 0 | } Unexecuted instantiation: accelerated.c:record_aes_gcm_encrypt_size Unexecuted instantiation: x86-common.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-cbc-x86-aesni.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-cbc-x86-ssse3.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-ccm-x86-aesni.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-gcm-padlock.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-gcm-x86-aesni.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-gcm-x86-pclmul-avx.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-gcm-x86-pclmul.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-gcm-x86-ssse3.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-padlock.c:record_aes_gcm_encrypt_size Unexecuted instantiation: aes-xts-x86-aesni.c:record_aes_gcm_encrypt_size Unexecuted instantiation: hmac-padlock.c:record_aes_gcm_encrypt_size Unexecuted instantiation: hmac-x86-ssse3.c:record_aes_gcm_encrypt_size Unexecuted instantiation: sha-padlock.c:record_aes_gcm_encrypt_size Unexecuted instantiation: sha-x86-ssse3.c:record_aes_gcm_encrypt_size |
39 | | |
40 | | void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out, |
41 | | size_t len, const AES_KEY * key, int enc); |
42 | | |
43 | | void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out, |
44 | | size_t len, const AES_KEY * key, |
45 | | unsigned char *ivec, const int enc); |
46 | | int aesni_set_decrypt_key(const unsigned char *userKey, const int bits, |
47 | | AES_KEY * key); |
48 | | int aesni_set_encrypt_key(const unsigned char *userKey, const int bits, |
49 | | AES_KEY * key); |
50 | | |
51 | | void aesni_ctr32_encrypt_blocks(const unsigned char *in, |
52 | | unsigned char *out, |
53 | | size_t blocks, |
54 | | const void *key, const unsigned char *ivec); |
55 | | |
56 | | size_t aesni_gcm_encrypt(const void *inp, void *out, size_t len, |
57 | | const AES_KEY * key, const unsigned char iv[16], |
58 | | uint64_t * Xi); |
59 | | |
60 | | size_t aesni_gcm_decrypt(const void *inp, void *out, size_t len, |
61 | | const AES_KEY * key, const unsigned char iv[16], |
62 | | uint64_t * Xi); |
63 | | |
64 | | void aesni_xts_encrypt(const unsigned char *in, unsigned char *out, |
65 | | size_t len, const AES_KEY * key, const AES_KEY * key2, |
66 | | const unsigned char iv[16]); |
67 | | |
68 | | void aesni_xts_decrypt(const unsigned char *in, unsigned char *out, |
69 | | size_t len, const AES_KEY * key, const AES_KEY * key2, |
70 | | const unsigned char iv[16]); |
71 | | |
72 | | int vpaes_set_encrypt_key(const unsigned char *userKey, int bits, |
73 | | AES_KEY * key); |
74 | | int vpaes_set_decrypt_key(const unsigned char *userKey, int bits, |
75 | | AES_KEY * key); |
76 | | void vpaes_cbc_encrypt(const unsigned char *in, unsigned char *out, |
77 | | size_t length, const AES_KEY * key, unsigned char *ivec, |
78 | | int enc); |
79 | | void vpaes_encrypt(const unsigned char *in, unsigned char *out, |
80 | | const AES_KEY * key); |
81 | | void vpaes_decrypt(const unsigned char *in, unsigned char *out, |
82 | | const AES_KEY * key); |
83 | | |
84 | | extern const gnutls_crypto_cipher_st _gnutls_aes_gcm_pclmul; |
85 | | extern const gnutls_crypto_cipher_st _gnutls_aes_gcm_pclmul_avx; |
86 | | extern const gnutls_crypto_cipher_st _gnutls_aes_gcm_x86_aesni; |
87 | | extern const gnutls_crypto_cipher_st _gnutls_aes_ccm_x86_aesni; |
88 | | extern const gnutls_crypto_cipher_st _gnutls_aes_xts_x86_aesni; |
89 | | extern const gnutls_crypto_cipher_st _gnutls_aes_gcm_x86_ssse3; |
90 | | |
91 | | extern const gnutls_crypto_cipher_st _gnutls_aes_ssse3; |
92 | | |
93 | | extern const gnutls_crypto_cipher_st _gnutls_aesni_x86; |
94 | | |
95 | | #endif /* GNUTLS_LIB_ACCELERATED_X86_AES_X86_H */ |