Skip to content

Commit

Permalink
Merge pull request #742 from pbodilis/main
Browse files Browse the repository at this point in the history
fix size_t to int cast to comply to openssl signatures
  • Loading branch information
pabuhler authored Jan 28, 2025
2 parents 9a0c37a + 3b9af4b commit b84eb57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions crypto/cipher/aes_gcm_ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_aad(void *cv,
srtp_octet_string_hex_string(aad, aad_len));

if (c->dir == srtp_direction_encrypt) {
if (EVP_EncryptUpdate(c->ctx, NULL, &len, aad, aad_len) != 1) {
if (EVP_EncryptUpdate(c->ctx, NULL, &len, aad, (int)aad_len) != 1) {
return srtp_err_status_algo_fail;
}
} else {
if (EVP_DecryptUpdate(c->ctx, NULL, &len, aad, aad_len) != 1) {
if (EVP_DecryptUpdate(c->ctx, NULL, &len, aad, (int)aad_len) != 1) {
return srtp_err_status_algo_fail;
}
}
Expand Down Expand Up @@ -303,7 +303,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_encrypt(void *cv,
/*
* Encrypt the data
*/
if (EVP_EncryptUpdate(c->ctx, dst, &len, src, src_len) != 1) {
if (EVP_EncryptUpdate(c->ctx, dst, &len, src, (int)src_len) != 1) {
return srtp_err_status_algo_fail;
}
*dst_len = len;
Expand All @@ -319,7 +319,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_encrypt(void *cv,
/*
* Retrieve the tag
*/
if (EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len,
if (EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, (int)c->tag_len,
dst + *dst_len) != 1) {
return srtp_err_status_algo_fail;
}
Expand Down Expand Up @@ -360,7 +360,8 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv,
/*
* Decrypt the data
*/
if (EVP_DecryptUpdate(c->ctx, dst, &len, src, src_len - c->tag_len) != 1) {
if (EVP_DecryptUpdate(c->ctx, dst, &len, src,
(int)(src_len - c->tag_len)) != 1) {
return srtp_err_status_algo_fail;
}
*dst_len = len;
Expand All @@ -371,7 +372,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv,
* explicitly cast away const of src
*/
if (EVP_CIPHER_CTX_ctrl(
c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len,
c->ctx, EVP_CTRL_GCM_SET_TAG, (int)c->tag_len,
(void *)(uintptr_t)(src + (src_len - c->tag_len))) != 1) {
return srtp_err_status_algo_fail;
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/cipher/aes_icm_ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_encrypt(void *cv,
return srtp_err_status_buffer_small;
}

if (!EVP_EncryptUpdate(c->ctx, dst, &len, src, src_len)) {
if (!EVP_EncryptUpdate(c->ctx, dst, &len, src, (int)src_len)) {
return srtp_err_status_cipher_fail;
}
*dst_len = len;
Expand Down

0 comments on commit b84eb57

Please sign in to comment.