Lines Matching full:if
14 #if defined(MBEDTLS_CIPHER_C)
27 #if defined(MBEDTLS_CHACHAPOLY_C)
31 #if defined(MBEDTLS_GCM_C)
35 #if defined(MBEDTLS_CCM_C)
39 #if defined(MBEDTLS_CHACHA20_C)
43 #if defined(MBEDTLS_CMAC_C)
47 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED)
51 #if defined(MBEDTLS_NIST_KW_C)
70 if (!supported_init) { in mbedtls_cipher_list()
92 if (def->type == cipher_type) { in mbedtls_cipher_info_from_type()
105 if (NULL == cipher_name) { in mbedtls_cipher_info_from_string()
110 if (!strcmp(def->info->name, cipher_name)) { in mbedtls_cipher_info_from_string()
126 if (mbedtls_cipher_get_base(def->info)->cipher == cipher_id && in mbedtls_cipher_info_from_values()
136 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED)
191 if (taglen == 0) { in mbedtls_psa_translate_cipher_mode()
209 if (ctx == NULL) { in mbedtls_cipher_free()
213 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_free()
214 if (ctx->psa_enabled == 1) { in mbedtls_cipher_free()
215 if (ctx->cipher_ctx != NULL) { in mbedtls_cipher_free()
219 if (cipher_psa->slot_state == MBEDTLS_CIPHER_PSA_KEY_OWNED) { in mbedtls_cipher_free()
232 #if defined(MBEDTLS_CMAC_C) in mbedtls_cipher_free()
233 if (ctx->cmac_ctx) { in mbedtls_cipher_free()
239 if (ctx->cipher_ctx) { in mbedtls_cipher_free()
249 if (dst == NULL || dst->cipher_info == NULL || in mbedtls_cipher_clone()
257 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) in mbedtls_cipher_clone()
265 if (mbedtls_cipher_get_base(dst->cipher_info)->ctx_clone_func) in mbedtls_cipher_clone()
268 #if defined(MBEDTLS_CMAC_C) in mbedtls_cipher_clone()
269 if (dst->cmac_ctx != NULL && src->cmac_ctx != NULL) in mbedtls_cipher_clone()
278 if (cipher_info == NULL) { in mbedtls_cipher_setup()
284 if (mbedtls_cipher_get_base(cipher_info)->ctx_alloc_func != NULL) { in mbedtls_cipher_setup()
286 if (ctx->cipher_ctx == NULL) { in mbedtls_cipher_setup()
296 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED)
304 if (NULL == cipher_info || NULL == ctx) { in mbedtls_cipher_setup_psa()
311 if (alg == 0) { in mbedtls_cipher_setup_psa()
314 if (mbedtls_psa_translate_cipher_type(((mbedtls_cipher_type_t) cipher_info->type)) == 0) { in mbedtls_cipher_setup_psa()
321 if (cipher_psa == NULL) { in mbedtls_cipher_setup_psa()
335 if (NULL == cipher_info || NULL == ctx) in mbedtls_cipher_setup_info()
347 if (operation != MBEDTLS_ENCRYPT && operation != MBEDTLS_DECRYPT) { in mbedtls_cipher_setkey()
350 if (ctx->cipher_info == NULL) { in mbedtls_cipher_setkey()
353 #if defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT) in mbedtls_cipher_setkey()
354 if (MBEDTLS_MODE_ECB == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode) && in mbedtls_cipher_setkey()
360 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_setkey()
361 if (ctx->psa_enabled == 1) { in mbedtls_cipher_setkey()
372 if (key_bitlen % 8 != 0) { in mbedtls_cipher_setkey()
377 if (cipher_psa->slot_state != MBEDTLS_CIPHER_PSA_KEY_UNSET) { in mbedtls_cipher_setkey()
383 if (key_type == 0) { in mbedtls_cipher_setkey()
418 if ((ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_KEY_LEN) == 0 && in mbedtls_cipher_setkey()
426 #if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT) in mbedtls_cipher_setkey()
430 if (MBEDTLS_ENCRYPT == operation || in mbedtls_cipher_setkey()
438 if (MBEDTLS_DECRYPT == operation) { in mbedtls_cipher_setkey()
443 if (operation == MBEDTLS_ENCRYPT || operation == MBEDTLS_DECRYPT) { in mbedtls_cipher_setkey()
458 if (ctx->cipher_info == NULL) { in mbedtls_cipher_set_iv()
461 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_set_iv()
462 if (ctx->psa_enabled == 1) { in mbedtls_cipher_set_iv()
471 if (iv_len > MBEDTLS_MAX_IV_LENGTH) { in mbedtls_cipher_set_iv()
475 if ((ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_IV_LEN) != 0) { in mbedtls_cipher_set_iv()
481 if (actual_iv_size > iv_len) { in mbedtls_cipher_set_iv()
486 #if defined(MBEDTLS_CHACHA20_C) in mbedtls_cipher_set_iv()
487 if (((mbedtls_cipher_type_t) ctx->cipher_info->type) == MBEDTLS_CIPHER_CHACHA20) { in mbedtls_cipher_set_iv()
491 if (iv_len != 12) { in mbedtls_cipher_set_iv()
495 if (0 != mbedtls_chacha20_starts((mbedtls_chacha20_context *) ctx->cipher_ctx, in mbedtls_cipher_set_iv()
501 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_set_iv()
502 if (((mbedtls_cipher_type_t) ctx->cipher_info->type) == MBEDTLS_CIPHER_CHACHA20_POLY1305 && in mbedtls_cipher_set_iv()
509 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_set_iv()
510 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_set_iv()
517 #if defined(MBEDTLS_CCM_C) in mbedtls_cipher_set_iv()
518 if (MBEDTLS_MODE_CCM_STAR_NO_TAG == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_set_iv()
525 if (set_lengths_result != 0) { in mbedtls_cipher_set_iv()
529 if (ctx->operation == MBEDTLS_DECRYPT) { in mbedtls_cipher_set_iv()
531 } else if (ctx->operation == MBEDTLS_ENCRYPT) { in mbedtls_cipher_set_iv()
543 if (actual_iv_size != 0) { in mbedtls_cipher_set_iv()
553 if (ctx->cipher_info == NULL) { in mbedtls_cipher_reset()
557 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_reset()
558 if (ctx->psa_enabled == 1) { in mbedtls_cipher_reset()
570 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
574 if (ctx->cipher_info == NULL) { in mbedtls_cipher_update_ad()
578 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_update_ad()
579 if (ctx->psa_enabled == 1) { in mbedtls_cipher_update_ad()
587 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_update_ad()
588 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_update_ad()
594 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_update_ad()
595 if (MBEDTLS_CIPHER_CHACHA20_POLY1305 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) { in mbedtls_cipher_update_ad()
606 if (result != 0) { in mbedtls_cipher_update_ad()
625 if (ctx->cipher_info == NULL) { in mbedtls_cipher_update()
629 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_update()
630 if (ctx->psa_enabled == 1) { in mbedtls_cipher_update()
640 if (0 == block_size) { in mbedtls_cipher_update()
644 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_ECB) { in mbedtls_cipher_update()
645 if (ilen != block_size) { in mbedtls_cipher_update()
651 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ecb_func(ctx->cipher_ctx, in mbedtls_cipher_update()
660 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_update()
661 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_GCM) { in mbedtls_cipher_update()
668 #if defined(MBEDTLS_CCM_C) in mbedtls_cipher_update()
669 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_CCM_STAR_NO_TAG) { in mbedtls_cipher_update()
676 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_update()
677 if (((mbedtls_cipher_type_t) ctx->cipher_info->type) == MBEDTLS_CIPHER_CHACHA20_POLY1305) { in mbedtls_cipher_update()
684 if (input == output && in mbedtls_cipher_update()
689 #if defined(MBEDTLS_CIPHER_MODE_CBC) in mbedtls_cipher_update()
690 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_CBC) { in mbedtls_cipher_update()
694 * If there is not enough data for a full block, cache it. in mbedtls_cipher_update()
696 if ((ctx->operation == MBEDTLS_DECRYPT && NULL != ctx->add_padding && in mbedtls_cipher_update()
712 if (0 != ctx->unprocessed_len) { in mbedtls_cipher_update()
718 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx, in mbedtls_cipher_update()
738 if (0 != ilen) { in mbedtls_cipher_update()
744 if (copy_len == 0 && in mbedtls_cipher_update()
760 if (ilen) { in mbedtls_cipher_update()
761 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx, in mbedtls_cipher_update()
776 #if defined(MBEDTLS_CIPHER_MODE_CFB) in mbedtls_cipher_update()
777 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_CFB) { in mbedtls_cipher_update()
778 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cfb_func(ctx->cipher_ctx, in mbedtls_cipher_update()
792 #if defined(MBEDTLS_CIPHER_MODE_OFB) in mbedtls_cipher_update()
793 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_OFB) { in mbedtls_cipher_update()
794 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ofb_func(ctx->cipher_ctx, in mbedtls_cipher_update()
808 #if defined(MBEDTLS_CIPHER_MODE_CTR) in mbedtls_cipher_update()
809 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_CTR) { in mbedtls_cipher_update()
810 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->ctr_func(ctx->cipher_ctx, in mbedtls_cipher_update()
825 #if defined(MBEDTLS_CIPHER_MODE_XTS) in mbedtls_cipher_update()
826 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_XTS) { in mbedtls_cipher_update()
827 if (ctx->unprocessed_len > 0) { in mbedtls_cipher_update()
838 if (ret != 0) { in mbedtls_cipher_update()
848 #if defined(MBEDTLS_CIPHER_MODE_STREAM) in mbedtls_cipher_update()
849 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) == MBEDTLS_MODE_STREAM) { in mbedtls_cipher_update()
850 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->stream_func(ctx->cipher_ctx, in mbedtls_cipher_update()
865 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
866 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
893 if (NULL == input || NULL == data_len) { in mbedtls_get_pkcs_padding()
911 /* If the padding is invalid, set the output length to 0 */ in mbedtls_get_pkcs_padding()
918 #if defined(MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS)
937 if (NULL == input || NULL == data_len) { in get_one_and_zeros_padding()
962 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN)
985 if (NULL == input || NULL == data_len) { in get_zeros_and_len_padding()
1009 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS)
1025 if (NULL == input || NULL == data_len) { in get_zeros_padding()
1049 if (NULL == input || NULL == data_len) { in get_no_padding()
1062 if (ctx->cipher_info == NULL) { in mbedtls_cipher_finish()
1066 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_finish()
1067 if (ctx->psa_enabled == 1) { in mbedtls_cipher_finish()
1077 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) in mbedtls_cipher_finish()
1080 if (MBEDTLS_MODE_CBC == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_finish()
1081 if (ctx->get_padding == NULL) { in mbedtls_cipher_finish()
1087 if (MBEDTLS_MODE_CFB == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode) || in mbedtls_cipher_finish()
1097 if ((MBEDTLS_CIPHER_CHACHA20 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) || in mbedtls_cipher_finish()
1102 if (MBEDTLS_MODE_ECB == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_finish()
1103 if (ctx->unprocessed_len != 0) { in mbedtls_cipher_finish()
1110 #if defined(MBEDTLS_CIPHER_MODE_CBC) in mbedtls_cipher_finish()
1111 if (MBEDTLS_MODE_CBC == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_finish()
1114 if (MBEDTLS_ENCRYPT == ctx->operation) { in mbedtls_cipher_finish()
1116 if (NULL == ctx->add_padding) { in mbedtls_cipher_finish()
1117 if (0 != ctx->unprocessed_len) { in mbedtls_cipher_finish()
1126 } else if (mbedtls_cipher_get_block_size(ctx) != ctx->unprocessed_len) { in mbedtls_cipher_finish()
1129 * or an empty block if no padding in mbedtls_cipher_finish()
1131 if (NULL == ctx->add_padding && 0 == ctx->unprocessed_len) { in mbedtls_cipher_finish()
1139 if (0 != (ret = mbedtls_cipher_get_base(ctx->cipher_info)->cbc_func(ctx->cipher_ctx, in mbedtls_cipher_finish()
1150 if (MBEDTLS_DECRYPT == ctx->operation) { in mbedtls_cipher_finish()
1166 #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
1170 if (NULL == ctx->cipher_info || in mbedtls_cipher_set_padding_mode()
1175 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_set_padding_mode()
1176 if (ctx->psa_enabled == 1) { in mbedtls_cipher_set_padding_mode()
1180 if (mode != MBEDTLS_PADDING_NONE) { in mbedtls_cipher_set_padding_mode()
1189 #if defined(MBEDTLS_CIPHER_PADDING_PKCS7) in mbedtls_cipher_set_padding_mode()
1195 #if defined(MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS) in mbedtls_cipher_set_padding_mode()
1201 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN) in mbedtls_cipher_set_padding_mode()
1207 #if defined(MBEDTLS_CIPHER_PADDING_ZEROS) in mbedtls_cipher_set_padding_mode()
1226 #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
1230 if (ctx->cipher_info == NULL) { in mbedtls_cipher_write_tag()
1234 if (MBEDTLS_ENCRYPT != ctx->operation) { in mbedtls_cipher_write_tag()
1238 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_write_tag()
1239 if (ctx->psa_enabled == 1) { in mbedtls_cipher_write_tag()
1247 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_write_tag()
1248 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_write_tag()
1258 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_write_tag()
1259 if (MBEDTLS_CIPHER_CHACHA20_POLY1305 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) { in mbedtls_cipher_write_tag()
1261 if (tag_len != 16U) { in mbedtls_cipher_write_tag()
1279 if (ctx->cipher_info == NULL) { in mbedtls_cipher_check_tag()
1283 if (MBEDTLS_DECRYPT != ctx->operation) { in mbedtls_cipher_check_tag()
1287 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_check_tag()
1288 if (ctx->psa_enabled == 1) { in mbedtls_cipher_check_tag()
1299 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_check_tag()
1300 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_check_tag()
1305 if (tag_len > sizeof(check_tag)) { in mbedtls_cipher_check_tag()
1309 if (0 != (ret = mbedtls_gcm_finish( in mbedtls_cipher_check_tag()
1317 if (mbedtls_ct_memcmp(tag, check_tag, tag_len) != 0) { in mbedtls_cipher_check_tag()
1324 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_check_tag()
1325 if (MBEDTLS_CIPHER_CHACHA20_POLY1305 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) { in mbedtls_cipher_check_tag()
1327 if (tag_len != sizeof(check_tag)) { in mbedtls_cipher_check_tag()
1333 if (ret != 0) { in mbedtls_cipher_check_tag()
1338 if (mbedtls_ct_memcmp(tag, check_tag, tag_len) != 0) { in mbedtls_cipher_check_tag()
1362 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_crypt()
1363 if (ctx->psa_enabled == 1) { in mbedtls_cipher_crypt()
1365 * a key has been set. If not, the key slot will in mbedtls_cipher_crypt()
1376 if (ctx->operation == MBEDTLS_DECRYPT) { in mbedtls_cipher_crypt()
1380 } else if (ctx->operation == MBEDTLS_ENCRYPT) { in mbedtls_cipher_crypt()
1392 if (status != PSA_SUCCESS) { in mbedtls_cipher_crypt()
1396 if (((mbedtls_cipher_mode_t) ctx->cipher_info->mode) != MBEDTLS_MODE_ECB) { in mbedtls_cipher_crypt()
1398 if (status != PSA_SUCCESS) { in mbedtls_cipher_crypt()
1406 if (status != PSA_SUCCESS) { in mbedtls_cipher_crypt()
1413 if (status != PSA_SUCCESS) { in mbedtls_cipher_crypt()
1422 if ((ret = mbedtls_cipher_set_iv(ctx, iv, iv_len)) != 0) { in mbedtls_cipher_crypt()
1426 if ((ret = mbedtls_cipher_reset(ctx)) != 0) { in mbedtls_cipher_crypt()
1430 if ((ret = mbedtls_cipher_update(ctx, input, ilen, in mbedtls_cipher_crypt()
1435 if ((ret = mbedtls_cipher_finish(ctx, output + *olen, in mbedtls_cipher_crypt()
1445 #if defined(MBEDTLS_CIPHER_MODE_AEAD)
1457 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_aead_encrypt()
1458 if (ctx->psa_enabled == 1) { in mbedtls_cipher_aead_encrypt()
1460 * a key has been set. If not, the key slot will in mbedtls_cipher_aead_encrypt()
1471 if (output == NULL || tag != output + ilen) { in mbedtls_cipher_aead_encrypt()
1481 if (status != PSA_SUCCESS) { in mbedtls_cipher_aead_encrypt()
1490 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_aead_encrypt()
1491 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_aead_encrypt()
1498 #if defined(MBEDTLS_CCM_C) in mbedtls_cipher_aead_encrypt()
1499 if (MBEDTLS_MODE_CCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_aead_encrypt()
1506 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_aead_encrypt()
1507 if (MBEDTLS_CIPHER_CHACHA20_POLY1305 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) { in mbedtls_cipher_aead_encrypt()
1509 if ((iv_len != mbedtls_cipher_info_get_iv_size(ctx->cipher_info)) || in mbedtls_cipher_aead_encrypt()
1534 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_aead_decrypt()
1535 if (ctx->psa_enabled == 1) { in mbedtls_cipher_aead_decrypt()
1537 * a key has been set. If not, the key slot will in mbedtls_cipher_aead_decrypt()
1548 if (input == NULL || tag != input + ilen) { in mbedtls_cipher_aead_decrypt()
1558 if (status == PSA_ERROR_INVALID_SIGNATURE) { in mbedtls_cipher_aead_decrypt()
1560 } else if (status != PSA_SUCCESS) { in mbedtls_cipher_aead_decrypt()
1568 #if defined(MBEDTLS_GCM_C) in mbedtls_cipher_aead_decrypt()
1569 if (MBEDTLS_MODE_GCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_aead_decrypt()
1577 if (ret == MBEDTLS_ERR_GCM_AUTH_FAILED) { in mbedtls_cipher_aead_decrypt()
1584 #if defined(MBEDTLS_CCM_C) in mbedtls_cipher_aead_decrypt()
1585 if (MBEDTLS_MODE_CCM == ((mbedtls_cipher_mode_t) ctx->cipher_info->mode)) { in mbedtls_cipher_aead_decrypt()
1593 if (ret == MBEDTLS_ERR_CCM_AUTH_FAILED) { in mbedtls_cipher_aead_decrypt()
1600 #if defined(MBEDTLS_CHACHAPOLY_C) in mbedtls_cipher_aead_decrypt()
1601 if (MBEDTLS_CIPHER_CHACHA20_POLY1305 == ((mbedtls_cipher_type_t) ctx->cipher_info->type)) { in mbedtls_cipher_aead_decrypt()
1605 if ((iv_len != mbedtls_cipher_info_get_iv_size(ctx->cipher_info)) || in mbedtls_cipher_aead_decrypt()
1614 if (ret == MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED) { in mbedtls_cipher_aead_decrypt()
1626 #if defined(MBEDTLS_CIPHER_MODE_AEAD) || defined(MBEDTLS_NIST_KW_C)
1637 #if defined(MBEDTLS_NIST_KW_C) in mbedtls_cipher_auth_encrypt_ext()
1638 if ( in mbedtls_cipher_auth_encrypt_ext()
1639 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_auth_encrypt_ext()
1650 if (iv_len != 0 || tag_len != 0 || ad_len != 0) { in mbedtls_cipher_auth_encrypt_ext()
1662 #if defined(MBEDTLS_CIPHER_MODE_AEAD) in mbedtls_cipher_auth_encrypt_ext()
1664 if (output_len < ilen + tag_len) { in mbedtls_cipher_auth_encrypt_ext()
1688 #if defined(MBEDTLS_NIST_KW_C) in mbedtls_cipher_auth_decrypt_ext()
1689 if ( in mbedtls_cipher_auth_decrypt_ext()
1690 #if defined(MBEDTLS_USE_PSA_CRYPTO) && !defined(MBEDTLS_DEPRECATED_REMOVED) in mbedtls_cipher_auth_decrypt_ext()
1701 if (iv_len != 0 || tag_len != 0 || ad_len != 0) { in mbedtls_cipher_auth_decrypt_ext()
1713 #if defined(MBEDTLS_CIPHER_MODE_AEAD) in mbedtls_cipher_auth_decrypt_ext()
1715 if (ilen < tag_len || output_len < ilen - tag_len) { in mbedtls_cipher_auth_decrypt_ext()