@@ -3146,7 +3146,7 @@ static void psa_aead_abort( aead_operation_t *operation )
31463146 mbedtls_ccm_free ( & operation -> ctx .ccm );
31473147 break ;
31483148#endif /* MBEDTLS_CCM_C */
3149- #if defined(MBEDTLS_CCM_C )
3149+ #if defined(MBEDTLS_GCM_C )
31503150 case PSA_ALG_GCM :
31513151 mbedtls_gcm_free ( & operation -> ctx .gcm );
31523152 break ;
@@ -3259,6 +3259,7 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key,
32593259 }
32603260 tag = ciphertext + plaintext_length ;
32613261
3262+ #if defined(MBEDTLS_GCM_C )
32623263 if ( operation .core_alg == PSA_ALG_GCM )
32633264 {
32643265 status = mbedtls_to_psa_error (
@@ -3270,7 +3271,10 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key,
32703271 plaintext , ciphertext ,
32713272 operation .tag_length , tag ) );
32723273 }
3273- else if ( operation .core_alg == PSA_ALG_CCM )
3274+ else
3275+ #endif /* MBEDTLS_GCM_C */
3276+ #if defined(MBEDTLS_CCM_C )
3277+ if ( operation .core_alg == PSA_ALG_CCM )
32743278 {
32753279 status = mbedtls_to_psa_error (
32763280 mbedtls_ccm_encrypt_and_tag ( & operation .ctx .ccm ,
@@ -3282,6 +3286,7 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key,
32823286 tag , operation .tag_length ) );
32833287 }
32843288 else
3289+ #endif /* MBEDTLS_CCM_C */
32853290 {
32863291 return ( PSA_ERROR_NOT_SUPPORTED );
32873292 }
@@ -3339,6 +3344,7 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key,
33393344 if ( status != PSA_SUCCESS )
33403345 return ( status );
33413346
3347+ #if defined(MBEDTLS_GCM_C )
33423348 if ( operation .core_alg == PSA_ALG_GCM )
33433349 {
33443350 status = psa_aead_unpadded_locate_tag ( operation .tag_length ,
@@ -3356,7 +3362,10 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key,
33563362 tag , operation .tag_length ,
33573363 ciphertext , plaintext ) );
33583364 }
3359- else if ( operation .core_alg == PSA_ALG_CCM )
3365+ else
3366+ #endif /* MBEDTLS_GCM_C */
3367+ #if defined(MBEDTLS_CCM_C )
3368+ if ( operation .core_alg == PSA_ALG_CCM )
33603369 {
33613370 status = psa_aead_unpadded_locate_tag ( operation .tag_length ,
33623371 ciphertext , ciphertext_length ,
@@ -3374,6 +3383,7 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key,
33743383 tag , operation .tag_length ) );
33753384 }
33763385 else
3386+ #endif /* MBEDTLS_CCM_C */
33773387 {
33783388 return ( PSA_ERROR_NOT_SUPPORTED );
33793389 }
0 commit comments