@@ -40,8 +40,7 @@ static TEE_Result do_update_cipher(struct drvcrypt_cipher_update *dupdate);
40
40
* Constants definition of the AES algorithm
41
41
*/
42
42
static const struct cipheralg aes_alg [] = {
43
- {
44
- /* AES ECB No Pad */
43
+ [TEE_CHAIN_MODE_ECB_NOPAD ] = {
45
44
.type = OP_ALGO (AES ) | ALGO_AAI (AES_ECB ),
46
45
.size_block = TEE_AES_BLOCK_SIZE ,
47
46
.size_ctx = 0 ,
@@ -50,8 +49,7 @@ static const struct cipheralg aes_alg[] = {
50
49
.def_key = { .min = 16 , .max = 32 , .mod = 8 },
51
50
.update = do_update_cipher ,
52
51
},
53
- {
54
- /* AES CBC No Pad */
52
+ [TEE_CHAIN_MODE_CBC_NOPAD ] = {
55
53
.type = OP_ALGO (AES ) | ALGO_AAI (AES_CBC ),
56
54
.size_block = TEE_AES_BLOCK_SIZE ,
57
55
.size_ctx = 2 * sizeof (uint64_t ),
@@ -60,8 +58,7 @@ static const struct cipheralg aes_alg[] = {
60
58
.def_key = { .min = 16 , .max = 32 , .mod = 8 },
61
59
.update = do_update_cipher ,
62
60
},
63
- {
64
- /* AES CTR */
61
+ [TEE_CHAIN_MODE_CTR ] = {
65
62
.type = OP_ALGO (AES ) | ALGO_AAI (AES_CTR_MOD128 ),
66
63
.size_block = TEE_AES_BLOCK_SIZE ,
67
64
.size_ctx = 2 * sizeof (uint64_t ),
@@ -70,12 +67,10 @@ static const struct cipheralg aes_alg[] = {
70
67
.def_key = { .min = 16 , .max = 32 , .mod = 8 },
71
68
.update = do_update_streaming ,
72
69
},
73
- {
74
- /* AES CTS, combination of CBC and ECB mode */
70
+ [TEE_CHAIN_MODE_CTS ] = {
75
71
.type = 0 ,
76
72
},
77
- {
78
- /* AES XTS, tweakable ECB cipher block */
73
+ [TEE_CHAIN_MODE_XTS ] = {
79
74
.type = OP_ALGO (AES ) | ALGO_AAI (AES_ECB ),
80
75
.size_block = TEE_AES_BLOCK_SIZE ,
81
76
.size_ctx = 0 ,
@@ -90,8 +85,7 @@ static const struct cipheralg aes_alg[] = {
90
85
* Constants definition of the DES algorithm
91
86
*/
92
87
static const struct cipheralg des_alg [] = {
93
- {
94
- /* DES ECB No Pad */
88
+ [TEE_CHAIN_MODE_ECB_NOPAD ] = {
95
89
.type = OP_ALGO (DES ) | ALGO_AAI (DES_ECB ),
96
90
.size_block = TEE_DES_BLOCK_SIZE ,
97
91
.size_ctx = 0 ,
@@ -100,8 +94,7 @@ static const struct cipheralg des_alg[] = {
100
94
.def_key = { .min = 8 , .max = 8 , .mod = 8 },
101
95
.update = do_update_cipher ,
102
96
},
103
- {
104
- /* DES CBC No Pad */
97
+ [TEE_CHAIN_MODE_CBC_NOPAD ] = {
105
98
.type = OP_ALGO (DES ) | ALGO_AAI (DES_CBC ),
106
99
.size_block = TEE_DES_BLOCK_SIZE ,
107
100
.size_ctx = sizeof (uint64_t ),
@@ -116,8 +109,7 @@ static const struct cipheralg des_alg[] = {
116
109
* Constants definition of the DES3 algorithm
117
110
*/
118
111
static const struct cipheralg des3_alg [] = {
119
- {
120
- /* Triple-DES ECB No Pad */
112
+ [TEE_CHAIN_MODE_ECB_NOPAD ] = {
121
113
.type = OP_ALGO (3D ES ) | ALGO_AAI (DES_ECB ),
122
114
.size_block = TEE_DES_BLOCK_SIZE ,
123
115
.size_ctx = 0 ,
@@ -126,7 +118,7 @@ static const struct cipheralg des3_alg[] = {
126
118
.def_key = { .min = 16 , .max = 24 , .mod = 8 },
127
119
.update = do_update_cipher ,
128
120
},
129
- {
121
+ [ TEE_CHAIN_MODE_CBC_NOPAD ] = {
130
122
/* Triple-DES CBC No Pad */
131
123
.type = OP_ALGO (3D ES ) | ALGO_AAI (DES_CBC ),
132
124
.size_block = TEE_DES_BLOCK_SIZE ,
@@ -186,7 +178,7 @@ enum caam_status caam_cipher_block(struct cipherdata *ctx, bool savectx,
186
178
struct caambuf * outdata , bool blockbuf )
187
179
{
188
180
enum caam_status retstatus = CAAM_FAILURE ;
189
- struct caam_jobctx jobctx = {};
181
+ struct caam_jobctx jobctx = { };
190
182
uint32_t * desc = ctx -> descriptor ;
191
183
struct caamsgtbuf src_sgt = {
192
184
.sgt_type = false
@@ -705,15 +697,15 @@ static TEE_Result do_update_streaming(struct drvcrypt_cipher_update *dupdate)
705
697
TEE_Result ret = TEE_ERROR_GENERIC ;
706
698
enum caam_status retstatus = CAAM_FAILURE ;
707
699
struct cipherdata * ctx = dupdate -> ctx ;
708
- struct caambuf srcbuf = {};
709
- struct caambuf dstbuf = {};
700
+ struct caambuf srcbuf = { };
701
+ struct caambuf dstbuf = { };
710
702
paddr_t psrc = 0 ;
711
703
size_t fullSize = 0 ;
712
704
size_t size_topost = 0 ;
713
705
size_t size_todo = 0 ;
714
706
size_t size_indone = 0 ;
715
707
int realloc = 0 ;
716
- struct caambuf dst_align = {};
708
+ struct caambuf dst_align = { };
717
709
718
710
CIPHER_TRACE ("Length=%zu - %s" , dupdate -> src .length ,
719
711
ctx -> encrypt ? "Encrypt" : "Decrypt" );
@@ -871,10 +863,10 @@ static TEE_Result do_update_cipher(struct drvcrypt_cipher_update *dupdate)
871
863
TEE_Result ret = TEE_ERROR_GENERIC ;
872
864
enum caam_status retstatus = CAAM_FAILURE ;
873
865
struct cipherdata * ctx = dupdate -> ctx ;
874
- struct caambuf srcbuf = {};
875
- struct caambuf dstbuf = {};
866
+ struct caambuf srcbuf = { };
867
+ struct caambuf dstbuf = { };
876
868
int realloc = 0 ;
877
- struct caambuf dst_align = {};
869
+ struct caambuf dst_align = { };
878
870
unsigned int nb_buf = 0 ;
879
871
size_t offset = 0 ;
880
872
0 commit comments