Skip to content

Commit 00a7f9b

Browse files
authored
Merge pull request #649 from pabuhler/set-iv-len-once
iv length is constant so set only once
2 parents fab73a3 + 05c52b6 commit 00a7f9b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crypto/cipher/aes_gcm_ossl.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ static srtp_err_status_t srtp_aes_gcm_openssl_context_init(void *cv,
199199
return (srtp_err_status_init_fail);
200200
}
201201

202+
if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_IVLEN, 12, 0)) {
203+
return (srtp_err_status_init_fail);
204+
}
205+
202206
return (srtp_err_status_ok);
203207
}
204208

@@ -222,10 +226,6 @@ static srtp_err_status_t srtp_aes_gcm_openssl_set_iv(
222226
debug_print(srtp_mod_aes_gcm, "setting iv: %s",
223227
srtp_octet_string_hex_string(iv, 12));
224228

225-
if (!EVP_CIPHER_CTX_ctrl(c->ctx, EVP_CTRL_GCM_SET_IVLEN, 12, 0)) {
226-
return (srtp_err_status_init_fail);
227-
}
228-
229229
if (!EVP_CipherInit_ex(c->ctx, NULL, NULL, NULL, iv,
230230
(c->dir == srtp_direction_encrypt ? 1 : 0))) {
231231
return (srtp_err_status_init_fail);

0 commit comments

Comments
 (0)