blob: 70b278747c6d9ddaa8b49b12be6adb3b190063d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/**
* \file
* \author Egor Tensin <Egor.Tensin@gmail.com>
* \date 2015
* \copyright This file is licensed under the terms of the MIT License.
* See LICENSE.txt for details.
*/
#pragma once
#include "algorithm.h"
#include "data.h"
#include "error.h"
#include "mode.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef union
{
AesNI_Aes128_RoundKeys aes128_key_schedule;
AesNI_Aes192_RoundKeys aes192_key_schedule;
AesNI_Aes256_RoundKeys aes256_key_schedule;
}
AesNI_EncryptionParams;
typedef union
{
AesNI_Aes128_RoundKeys aes128_key_schedule;
AesNI_Aes192_RoundKeys aes192_key_schedule;
AesNI_Aes256_RoundKeys aes256_key_schedule;
}
AesNI_DecryptionParams;
typedef union
{
AesNI_Block128 aes_block;
}
AesNI_State;
typedef union
{
AesNI_Block128 aes128_key;
AesNI_Block192 aes192_key;
AesNI_Block256 aes256_key;
}
AesNI_AlgorithmParams;
typedef struct
{
AesNI_Algorithm algorithm;
AesNI_EncryptionParams encrypt_params;
AesNI_DecryptionParams decrypt_params;
AesNI_Mode mode;
AesNI_State iv;
}
AesNI_Box;
AesNI_StatusCode aesni_box_init(
AesNI_Box*,
AesNI_Algorithm,
const AesNI_AlgorithmParams*,
AesNI_Mode,
const AesNI_State* iv,
AesNI_ErrorDetails*);
AesNI_StatusCode aesni_box_encrypt(
AesNI_Box*,
const AesNI_State*,
AesNI_State*,
AesNI_ErrorDetails*);
AesNI_StatusCode aesni_box_decrypt(
AesNI_Box*,
const AesNI_State*,
AesNI_State*,
AesNI_ErrorDetails*);
#ifdef __cplusplus
}
#endif
|