Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some cipher_driver fixes #663

Merged
merged 2 commits into from
Dec 12, 2023
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: 1 addition & 1 deletion crypto/include/cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ typedef struct srtp_cipher_type_t {
srtp_cipher_init_func_t init;
srtp_cipher_set_aad_func_t set_aad;
srtp_cipher_encrypt_func_t encrypt;
srtp_cipher_encrypt_func_t decrypt;
srtp_cipher_decrypt_func_t decrypt;
srtp_cipher_set_iv_func_t set_iv;
srtp_cipher_get_tag_func_t get_tag;
const char *description;
Expand Down
14 changes: 8 additions & 6 deletions crypto/test/cipher_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ srtp_err_status_t cipher_array_alloc_init(srtp_cipher_t ***ca,
{
int i, j;
srtp_err_status_t status;
uint8_t *key;
uint8_t *key = NULL;
srtp_cipher_t **cipher_array;
/* pad klen allocation, to handle aes_icm reading 16 bytes for the
14-byte salt */
Expand All @@ -453,11 +453,13 @@ srtp_err_status_t cipher_array_alloc_init(srtp_cipher_t ***ca,
/* set ca to location of cipher_array */
*ca = cipher_array;

/* allocate key */
key = srtp_crypto_alloc(klen_pad);
if (key == NULL) {
srtp_crypto_free(cipher_array);
return srtp_err_status_alloc_fail;
/* allocate key , allow zero key for example null cipher */
if (klen_pad > 0) {
key = srtp_crypto_alloc(klen_pad);
if (key == NULL) {
srtp_crypto_free(cipher_array);
return srtp_err_status_alloc_fail;
}
}

/* allocate and initialize an array of ciphers */
Expand Down
Loading