Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crypto/cipher/aes_gcm_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ static srtp_err_status_t srtp_aes_gcm_mbedtls_decrypt(void *cv,
*dst_len = out_len;
c->aad_size = 0;
if (status != PSA_SUCCESS) {
debug_print(srtp_mod_aes_gcm, "mbedtls error code: %d", status);
return srtp_err_status_auth_fail;
}

return srtp_err_status_ok;
}
9 changes: 9 additions & 0 deletions crypto/cipher/aes_icm_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ static srtp_err_status_t srtp_aes_icm_mbedtls_context_init(void *cv,

status = psa_crypto_init();

if (status != PSA_SUCCESS) {
debug_print(srtp_mod_aes_icm, "status: %d", status);
return srtp_err_status_cipher_fail;
}
Comment thread
pabuhler marked this conversation as resolved.

/*
* set counter and initial values to 'offset' value, being careful not to
* go past the end of the key buffer
Expand Down Expand Up @@ -346,6 +351,7 @@ static srtp_err_status_t srtp_aes_icm_mbedtls_context_init(void *cv,
psa_set_key_algorithm(&attr, PSA_ALG_CTR);

if (c->ctx->key_id != PSA_KEY_ID_NULL) {
psa_destroy_key(c->ctx->key_id);
Comment thread
pabuhler marked this conversation as resolved.
c->ctx->key_id = PSA_KEY_ID_NULL;
}

Expand All @@ -355,6 +361,7 @@ static srtp_err_status_t srtp_aes_icm_mbedtls_context_init(void *cv,
if (status != PSA_SUCCESS) {
psa_destroy_key(c->ctx->key_id);
debug_print(srtp_mod_aes_icm, "status: %d", status);
return srtp_err_status_cipher_fail;
}

return srtp_err_status_ok;
Expand Down Expand Up @@ -439,6 +446,7 @@ static srtp_err_status_t srtp_aes_icm_mbedtls_encrypt(void *cv,
if (*dst_len < src_len) {
return srtp_err_status_buffer_small;
}

status =
psa_cipher_update(&(c->ctx->op), src, src_len, dst, *dst_len, &out_len);

Expand All @@ -447,6 +455,7 @@ static srtp_err_status_t srtp_aes_icm_mbedtls_encrypt(void *cv,
psa_cipher_abort(&c->ctx->op);
return srtp_err_status_cipher_fail;
}

*dst_len = out_len;
debug_print(srtp_mod_aes_icm, "encrypted: %s",
srtp_octet_string_hex_string(dst, *dst_len));
Expand Down
Loading