From 6f3f8ae285326bccc0acf46dd76668719a2df45f Mon Sep 17 00:00:00 2001 From: Pierre Bodilis Date: Fri, 3 May 2024 12:57:13 +0200 Subject: [PATCH 1/2] [code] fix type conversion (XCode + arm64) --- crypto/cipher/aes_gcm_ossl.c | 12 ++++++------ crypto/cipher/aes_icm_ossl.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crypto/cipher/aes_gcm_ossl.c b/crypto/cipher/aes_gcm_ossl.c index 6a56450db..2e4d9ea44 100644 --- a/crypto/cipher/aes_gcm_ossl.c +++ b/crypto/cipher/aes_gcm_ossl.c @@ -270,13 +270,13 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_aad(void *cv, */ uint8_t dummy_tag[GCM_AUTH_TAG_LEN]; memset(dummy_tag, 0x0, GCM_AUTH_TAG_LEN); - if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, (int)c->tag_len, &dummy_tag)) { return (srtp_err_status_algo_fail); } } - rv = EVP_Cipher(c->ctx, NULL, aad, aad_len); + rv = EVP_Cipher(c->ctx, NULL, aad, (unsigned int)aad_len); if (rv < 0 || (uint32_t)rv != aad_len) { return (srtp_err_status_algo_fail); } else { @@ -304,7 +304,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_encrypt(void *cv, /* * Encrypt the data */ - EVP_Cipher(c->ctx, buf, buf, *enc_len); + EVP_Cipher(c->ctx, buf, buf, (unsigned int)*enc_len); return (srtp_err_status_ok); } @@ -333,7 +333,7 @@ static srtp_err_status_t srtp_aes_gcm_openssl_get_tag(void *cv, /* * Retreive the tag */ - if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, c->tag_len, buf)) { + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, (int)c->tag_len, buf)) { return (srtp_err_status_algo_fail); } @@ -365,11 +365,11 @@ static srtp_err_status_t srtp_aes_gcm_openssl_decrypt(void *cv, /* * Set the tag before decrypting */ - if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, c->tag_len, + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_TAG, (int)c->tag_len, buf + (*enc_len - c->tag_len))) { return (srtp_err_status_auth_fail); } - EVP_Cipher(c->ctx, buf, buf, *enc_len - c->tag_len); + EVP_Cipher(c->ctx, buf, buf, (unsigned int)(*enc_len - c->tag_len)); /* * Check the tag diff --git a/crypto/cipher/aes_icm_ossl.c b/crypto/cipher/aes_icm_ossl.c index 4319de5c6..a22a9297f 100644 --- a/crypto/cipher/aes_icm_ossl.c +++ b/crypto/cipher/aes_icm_ossl.c @@ -306,7 +306,7 @@ static srtp_err_status_t srtp_aes_icm_openssl_encrypt(void *cv, debug_print(srtp_mod_aes_icm, "rs0: %s", v128_hex_string(&c->counter)); - if (!EVP_EncryptUpdate(c->ctx, buf, &len, buf, *enc_len)) { + if (!EVP_EncryptUpdate(c->ctx, buf, &len, buf, (int)*enc_len)) { return srtp_err_status_cipher_fail; } *enc_len = len; From bdd6d8fb2faccd581b53246d51586a78d57e58d2 Mon Sep 17 00:00:00 2001 From: Pierre Bodilis Date: Fri, 10 May 2024 10:18:22 +0200 Subject: [PATCH 2/2] [reformat] --- crypto/cipher/aes_gcm_ossl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/cipher/aes_gcm_ossl.c b/crypto/cipher/aes_gcm_ossl.c index 2e4d9ea44..7b6966981 100644 --- a/crypto/cipher/aes_gcm_ossl.c +++ b/crypto/cipher/aes_gcm_ossl.c @@ -333,7 +333,8 @@ static srtp_err_status_t srtp_aes_gcm_openssl_get_tag(void *cv, /* * Retreive the tag */ - if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, (int)c->tag_len, buf)) { + if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_GET_TAG, (int)c->tag_len, + buf)) { return (srtp_err_status_algo_fail); }