Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dfcf20f

Browse filesBrowse files
tniessenMylesBorins
authored andcommitted
crypto: use new OpenSSL constants in CipherBase
This change replaces some constants with better alternatives which were unavailable in OpenSSL 1.0.2. PR-URL: #20339 Refs: #19794 Refs: #18138 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent b89d817 commit dfcf20f
Copy full SHA for dfcf20f

File tree

Expand file treeCollapse file tree

1 file changed

+3
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-8
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,10 +2791,7 @@ bool CipherBase::InitAuthenticated(const char *cipher_type, int iv_len,
27912791
int auth_tag_len) {
27922792
CHECK(IsAuthenticatedMode());
27932793

2794-
// TODO(tniessen) Use EVP_CTRL_AEAD_SET_IVLEN when migrating to OpenSSL 1.1.0
2795-
static_assert(EVP_CTRL_CCM_SET_IVLEN == EVP_CTRL_GCM_SET_IVLEN,
2796-
"OpenSSL constants differ between GCM and CCM");
2797-
if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_SET_IVLEN, iv_len, nullptr)) {
2794+
if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_IVLEN, iv_len, nullptr)) {
27982795
env()->ThrowError("Invalid IV length");
27992796
return false;
28002797
}
@@ -3085,10 +3082,8 @@ bool CipherBase::Final(unsigned char** out, int *out_len) {
30853082
// must be specified in advance.
30863083
if (mode == EVP_CIPH_GCM_MODE)
30873084
auth_tag_len_ = sizeof(auth_tag_);
3088-
// TOOD(tniessen) Use EVP_CTRL_AEAP_GET_TAG in OpenSSL 1.1.0
3089-
static_assert(EVP_CTRL_CCM_GET_TAG == EVP_CTRL_GCM_GET_TAG,
3090-
"OpenSSL constants differ between GCM and CCM");
3091-
CHECK_EQ(1, EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_GET_TAG, auth_tag_len_,
3085+
CHECK_EQ(1, EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_GET_TAG,
3086+
auth_tag_len_,
30923087
reinterpret_cast<unsigned char*>(auth_tag_)));
30933088
}
30943089
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.