Skip to content

Commit

Permalink
test: fix parallel/test-crypto-getcipherinfo crash
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jun 2, 2021
1 parent 7c3feb7 commit 84aa6ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/boringssl/.patches
Expand Up @@ -2,3 +2,4 @@ expose_ripemd160.patch
expose_aes-cfb.patch
expose_des-ede3.patch
src_add_impl_for_evp_pkey_get0.patch
ensure_name_not_null_in_evp_get_cipherbyname.patch
@@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Wed, 2 Jun 2021 11:58:18 +0200
Subject: Ensure name not null in EVP_get_cipherbyname

This adds a check to EVP_get_cipherbyname which ensures that name
is not null when passed to OPENSSL_strcasecmp, which cannot handle
null values.

OpenSSL already ensures this in their implementation of
EVP_get_cipherbyname by using OBJ_NAME_get, so this improves parity.

Upstreamed at https://boringssl-review.googlesource.com/c/boringssl/+/47844.

diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
index e771ed6589b4579cc35300d5b2a1b68d92e444f5..8205e121c152fe4e2d8df34a1ac2fe0498381f31 100644
--- a/crypto/cipher_extra/cipher_extra.c
+++ b/crypto/cipher_extra/cipher_extra.c
@@ -89,6 +89,10 @@ const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
}

const EVP_CIPHER *EVP_get_cipherbyname(const char *name) {
+ if (name == NULL) {
+ return NULL;
+ }
+
if (OPENSSL_strcasecmp(name, "rc4") == 0) {
return EVP_rc4();
} else if (OPENSSL_strcasecmp(name, "des-cbc") == 0) {

0 comments on commit 84aa6ca

Please sign in to comment.