@@ -336,15 +336,23 @@ psa_status_t cracen_aead_encrypt_setup(cracen_aead_operation_t *operation,
336336 const uint8_t * key_buffer , size_t key_buffer_size ,
337337 psa_algorithm_t alg )
338338{
339+ #ifdef CONFIG_SOC_NRF54L20
340+ return PSA_ERROR_NOT_SUPPORTED ;
341+ #else
339342 return setup (operation , CRACEN_ENCRYPT , attributes , key_buffer , key_buffer_size , alg );
343+ #endif
340344}
341345
342346psa_status_t cracen_aead_decrypt_setup (cracen_aead_operation_t * operation ,
343347 const psa_key_attributes_t * attributes ,
344348 const uint8_t * key_buffer , size_t key_buffer_size ,
345349 psa_algorithm_t alg )
346350{
351+ #ifdef CONFIG_SOC_NRF54L20
352+ return PSA_ERROR_NOT_SUPPORTED ;
353+ #else
347354 return setup (operation , CRACEN_DECRYPT , attributes , key_buffer , key_buffer_size , alg );
355+ #endif
348356}
349357
350358static psa_status_t set_nonce (cracen_aead_operation_t * operation , const uint8_t * nonce ,
@@ -363,6 +371,9 @@ static psa_status_t set_nonce(cracen_aead_operation_t *operation, const uint8_t
363371psa_status_t cracen_aead_set_nonce (cracen_aead_operation_t * operation , const uint8_t * nonce ,
364372 size_t nonce_length )
365373{
374+ #ifdef CONFIG_SOC_NRF54L20
375+ return PSA_ERROR_NOT_SUPPORTED ;
376+ #else
366377 psa_status_t status ;
367378
368379 status = set_nonce (operation , nonce , nonce_length );
@@ -382,15 +393,25 @@ psa_status_t cracen_aead_set_nonce(cracen_aead_operation_t *operation, const uin
382393 }
383394
384395 return PSA_SUCCESS ;
396+ #endif
385397}
386398
387- psa_status_t cracen_aead_set_lengths (cracen_aead_operation_t * operation , size_t ad_length ,
388- size_t plaintext_length )
399+ static void set_lengths (cracen_aead_operation_t * operation , size_t ad_length ,
400+ size_t plaintext_length )
389401{
390402 operation -> ad_length = ad_length ;
391403 operation -> plaintext_length = plaintext_length ;
404+ }
392405
406+ psa_status_t cracen_aead_set_lengths (cracen_aead_operation_t * operation , size_t ad_length ,
407+ size_t plaintext_length )
408+ {
409+ #ifdef CONFIG_SOC_NRF54L20
410+ return PSA_ERROR_NOT_SUPPORTED ;
411+ #else
412+ set_lengths (operation , ad_length , plaintext_length );
393413 return PSA_SUCCESS ;
414+ #endif
394415}
395416
396417static psa_status_t cracen_aead_update_internal (cracen_aead_operation_t * operation ,
@@ -504,13 +525,20 @@ static psa_status_t cracen_aead_update_internal(cracen_aead_operation_t *operati
504525psa_status_t cracen_aead_update_ad (cracen_aead_operation_t * operation , const uint8_t * input ,
505526 size_t input_length )
506527{
528+ #ifdef CONFIG_SOC_NRF54L20
529+ return PSA_ERROR_NOT_SUPPORTED ;
530+ #else
507531 return cracen_aead_update_internal (operation , input , input_length , NULL , 0 , NULL , true);
532+ #endif
508533}
509534
510535psa_status_t cracen_aead_update (cracen_aead_operation_t * operation , const uint8_t * input ,
511536 size_t input_length , uint8_t * output , size_t output_size ,
512537 size_t * output_length )
513538{
539+ #ifdef CONFIG_SOC_NRF54L20
540+ return PSA_ERROR_NOT_SUPPORTED ;
541+ #else
514542 /*
515543 * Even if no plain/ciphertext is provided we still wanna have one block
516544 * of AD buffered before creating/verifying the tag
@@ -543,6 +571,7 @@ psa_status_t cracen_aead_update(cracen_aead_operation_t *operation, const uint8_
543571
544572 return cracen_aead_update_internal (operation , input , input_length , output , output_size ,
545573 output_length , false);
574+ #endif
546575}
547576
548577static psa_status_t finalize_aead_encryption (cracen_aead_operation_t * operation , uint8_t * tag ,
@@ -573,6 +602,9 @@ psa_status_t cracen_aead_finish(cracen_aead_operation_t *operation, uint8_t *cip
573602 size_t ciphertext_size , size_t * ciphertext_length , uint8_t * tag ,
574603 size_t tag_size , size_t * tag_length )
575604{
605+ #ifdef CONFIG_SOC_NRF54L20
606+ return PSA_ERROR_NOT_SUPPORTED ;
607+ #else
576608 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED ;
577609
578610 if (operation -> ad_finished && (ciphertext_size < operation -> unprocessed_input_bytes )) {
@@ -597,6 +629,7 @@ psa_status_t cracen_aead_finish(cracen_aead_operation_t *operation, uint8_t *cip
597629 }
598630
599631 return finalize_aead_encryption (operation , tag , tag_size , tag_length );
632+ #endif
600633}
601634
602635static psa_status_t finalize_aead_decryption (cracen_aead_operation_t * operation , const uint8_t * tag )
@@ -620,6 +653,9 @@ psa_status_t cracen_aead_verify(cracen_aead_operation_t *operation, uint8_t *pla
620653 size_t plaintext_size , size_t * plaintext_length , const uint8_t * tag ,
621654 size_t tag_length )
622655{
656+ #ifdef CONFIG_SOC_NRF54L20
657+ return PSA_ERROR_NOT_SUPPORTED ;
658+ #else
623659 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED ;
624660
625661 if (operation -> ad_finished && plaintext_size < operation -> unprocessed_input_bytes ) {
@@ -644,6 +680,7 @@ psa_status_t cracen_aead_verify(cracen_aead_operation_t *operation, uint8_t *pla
644680 }
645681
646682 return finalize_aead_decryption (operation , tag );
683+ #endif
647684}
648685
649686psa_status_t cracen_aead_abort (cracen_aead_operation_t * operation )
@@ -707,22 +744,18 @@ psa_status_t cracen_aead_encrypt(const psa_key_attributes_t *attributes, const u
707744{
708745 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED ;
709746 cracen_aead_operation_t operation = {0 };
710- size_t tag_length ;
747+ size_t tag_length = 0 ;
711748
712749 if (ciphertext_size < plaintext_length ) {
713750 return PSA_ERROR_BUFFER_TOO_SMALL ;
714751 }
715752
716- status = cracen_aead_encrypt_setup (& operation , attributes ,
717- key_buffer , key_buffer_size , alg );
753+ status = setup (& operation , CRACEN_ENCRYPT , attributes , key_buffer , key_buffer_size , alg );
718754 if (status != PSA_SUCCESS ) {
719755 goto error_exit ;
720756 }
721757
722- status = cracen_aead_set_lengths (& operation , additional_data_length , plaintext_length );
723- if (status != PSA_SUCCESS ) {
724- goto error_exit ;
725- }
758+ set_lengths (& operation , additional_data_length , plaintext_length );
726759
727760 /* Do not call the cracen_aead_update*() functions to avoid using
728761 * HW context switching (process_on_hw()) in single-part operations.
@@ -775,8 +808,7 @@ psa_status_t cracen_aead_decrypt(const psa_key_attributes_t *attributes, const u
775808 psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED ;
776809 cracen_aead_operation_t operation = {0 };
777810
778- status = cracen_aead_decrypt_setup (& operation , attributes ,
779- key_buffer , key_buffer_size , alg );
811+ status = setup (& operation , CRACEN_DECRYPT , attributes , key_buffer , key_buffer_size , alg );
780812 if (status != PSA_SUCCESS ) {
781813 goto error_exit ;
782814 }
@@ -788,10 +820,7 @@ psa_status_t cracen_aead_decrypt(const psa_key_attributes_t *attributes, const u
788820 goto error_exit ;
789821 }
790822
791- status = cracen_aead_set_lengths (& operation , additional_data_length , * plaintext_length );
792- if (status != PSA_SUCCESS ) {
793- goto error_exit ;
794- }
823+ set_lengths (& operation , additional_data_length , * plaintext_length );
795824
796825 /* Do not call the cracen_aead_update*() functions to avoid using
797826 * HW context switching (process_on_hw()) in single-part operations.
0 commit comments