Skip to content

Commit

Permalink
[code] fix type conversion (XCode + arm64)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Bodilis committed May 3, 2024
1 parent 0c002e7 commit 6f3f8ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions crypto/cipher/aes_gcm_ossl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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
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 @@ -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;
Expand Down

0 comments on commit 6f3f8ae

Please sign in to comment.