@@ -292,24 +292,24 @@ psa_status_t cracen_cipher_encrypt(const psa_key_attributes_t *attributes,
292
292
* error and thus we don't need to write an else here.
293
293
*/
294
294
if (IS_ENABLED (PSA_NEED_CRACEN_ECB_NO_PADDING_AES ) && alg == PSA_ALG_ECB_NO_PADDING ) {
295
- struct sxkeyref key ;
296
295
297
- status = cracen_load_keyref (attributes , key_buffer , key_buffer_size , & key );
296
+ status = cracen_load_keyref (attributes , key_buffer , key_buffer_size ,
297
+ & operation .keyref );
298
298
if (status != PSA_SUCCESS ) {
299
299
return status ;
300
300
}
301
- return crypt_ecb (& operation .cipher , & key , input , input_length , output , output_size ,
302
- output_length , CRACEN_ENCRYPT );
301
+
302
+ return crypt_ecb (& operation .cipher , & operation .keyref , input , input_length , output ,
303
+ output_size , output_length , CRACEN_ENCRYPT );
303
304
}
304
305
if (IS_ENABLED (PSA_NEED_CRACEN_CBC_PKCS7_AES ) && alg == PSA_ALG_CBC_PKCS7 ) {
305
- struct sxkeyref key ;
306
-
307
- status = cracen_load_keyref (attributes , key_buffer , key_buffer_size , & key );
306
+ status = cracen_load_keyref (attributes , key_buffer , key_buffer_size ,
307
+ & operation .keyref );
308
308
if (status != PSA_SUCCESS ) {
309
309
return status ;
310
310
}
311
- return encrypt_cbc (& key , input , input_length , output , output_size , output_length ,
312
- iv );
311
+ return encrypt_cbc (& operation . keyref , input , input_length , output , output_size ,
312
+ output_length , iv );
313
313
}
314
314
315
315
status = setup (CRACEN_ENCRYPT , & operation , attributes , key_buffer , key_buffer_size , alg );
@@ -339,7 +339,6 @@ psa_status_t cracen_cipher_decrypt(const psa_key_attributes_t *attributes,
339
339
psa_status_t status ;
340
340
/* ChaCha20 only supports 12 bytes IV in the single part decryption function */
341
341
const size_t iv_size = (alg == PSA_ALG_STREAM_CIPHER ) ? 12 : SX_BLKCIPHER_IV_SZ ;
342
- struct sxkeyref key ;
343
342
* output_length = 0 ;
344
343
345
344
if (input_length == 0 ) {
@@ -350,20 +349,22 @@ psa_status_t cracen_cipher_decrypt(const psa_key_attributes_t *attributes,
350
349
* error and thus we don't need to write an else here.
351
350
*/
352
351
if (IS_ENABLED (PSA_NEED_CRACEN_ECB_NO_PADDING_AES ) && alg == PSA_ALG_ECB_NO_PADDING ) {
353
- status = cracen_load_keyref (attributes , key_buffer , key_buffer_size , & key );
352
+ status = cracen_load_keyref (attributes , key_buffer , key_buffer_size ,
353
+ & operation .keyref );
354
354
if (status != PSA_SUCCESS ) {
355
355
return status ;
356
356
}
357
- return crypt_ecb (& operation .cipher , & key , input , input_length , output , output_size ,
358
- output_length , CRACEN_DECRYPT );
357
+ return crypt_ecb (& operation .cipher , & operation . keyref , input , input_length , output ,
358
+ output_size , output_length , CRACEN_DECRYPT );
359
359
}
360
360
if (IS_ENABLED (PSA_NEED_CRACEN_CBC_PKCS7_AES ) && alg == PSA_ALG_CBC_PKCS7 ) {
361
- status = cracen_load_keyref (attributes , key_buffer , key_buffer_size , & key );
361
+ status = cracen_load_keyref (attributes , key_buffer , key_buffer_size ,
362
+ & operation .keyref );
362
363
if (status != PSA_SUCCESS ) {
363
364
return status ;
364
365
}
365
- return decrypt_cbc (& key , input + iv_size , input_length - iv_size , output ,
366
- output_size , output_length , input );
366
+ return decrypt_cbc (& operation . keyref , input + iv_size , input_length - iv_size ,
367
+ output , output_size , output_length , input );
367
368
}
368
369
369
370
if (input_length < iv_size ) {
0 commit comments