Skip to content

Commit b84eb57

Browse files
authored
Merge pull request #742 from pbodilis/main
fix size_t to int cast to comply to openssl signatures
2 parents 9a0c37a + 3b9af4b commit b84eb57

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

crypto/cipher/aes_gcm_ossl.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_aad(void *cv,
259259
srtp_octet_string_hex_string(aad, aad_len));
260260

261261
if (c->dir == srtp_direction_encrypt) {
262-
if (EVP_EncryptUpdate(c->ctx, NULL, &len, aad, aad_len) != 1) {
262+
if (EVP_EncryptUpdate(c->ctx, NULL, &len, aad, (int)aad_len) != 1) {
263263
return srtp_err_status_algo_fail;
264264
}
265265
} else {
266-
if (EVP_DecryptUpdate(c->ctx, NULL, &len, aad, aad_len) != 1) {
266+
if (EVP_DecryptUpdate(c->ctx, NULL, &len, aad, (int)aad_len) != 1) {
267267
return srtp_err_status_algo_fail;
268268
}
269269
}
@@ -303,7 +303,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_encrypt(void *cv,
303303
/*
304304
* Encrypt the data
305305
*/
306-
if (EVP_EncryptUpdate(c->ctx, dst, &len, src, src_len) != 1) {
306+
if (EVP_EncryptUpdate(c->ctx, dst, &len, src, (int)src_len) != 1) {
307307
return srtp_err_status_algo_fail;
308308
}
309309
*dst_len = len;
@@ -319,7 +319,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_encrypt(void *cv,
319319
/*
320320
* Retrieve the tag
321321
*/
322-
if (EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len,
322+
if (EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, (int)c->tag_len,
323323
dst + *dst_len) != 1) {
324324
return srtp_err_status_algo_fail;
325325
}
@@ -360,7 +360,8 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv,
360360
/*
361361
* Decrypt the data
362362
*/
363-
if (EVP_DecryptUpdate(c->ctx, dst, &len, src, src_len - c->tag_len) != 1) {
363+
if (EVP_DecryptUpdate(c->ctx, dst, &len, src,
364+
(int)(src_len - c->tag_len)) != 1) {
364365
return srtp_err_status_algo_fail;
365366
}
366367
*dst_len = len;
@@ -371,7 +372,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv,
371372
* explicitly cast away const of src
372373
*/
373374
if (EVP_CIPHER_CTX_ctrl(
374-
c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len,
375+
c->ctx, EVP_CTRL_GCM_SET_TAG, (int)c->tag_len,
375376
(void *)(uintptr_t)(src + (src_len - c->tag_len))) != 1) {
376377
return srtp_err_status_algo_fail;
377378
}

crypto/cipher/aes_icm_ossl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_encrypt(void *cv,
316316
return srtp_err_status_buffer_small;
317317
}
318318

319-
if (!EVP_EncryptUpdate(c->ctx, dst, &len, src, src_len)) {
319+
if (!EVP_EncryptUpdate(c->ctx, dst, &len, src, (int)src_len)) {
320320
return srtp_err_status_cipher_fail;
321321
}
322322
*dst_len = len;

0 commit comments

Comments
 (0)