Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: crash in ECDH.setPrivateKey (#17297)
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
patches/common/boringssl/handle_pub_key_null_in_ec_key_set_public_key.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Jeremy Apthorp <nornagon@nornagon.net> | ||
Date: Mon, 4 Mar 2019 10:59:35 -0800 | ||
Subject: handle pub_key == null in EC_KEY_set_public_key | ||
|
||
|
||
diff --git a/crypto/fipsmodule/ec/ec_key.c b/crypto/fipsmodule/ec/ec_key.c | ||
index 4bc12a073650f66f5ae8ba2beabb9a6fb2b21878..7e86ccb0d76c66f32fc05c7093c870d5da7b9994 100644 | ||
--- a/crypto/fipsmodule/ec/ec_key.c | ||
+++ b/crypto/fipsmodule/ec/ec_key.c | ||
@@ -267,7 +267,7 @@ int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) { | ||
return 0; | ||
} | ||
|
||
- if (EC_GROUP_cmp(key->group, pub_key->group, NULL) != 0) { | ||
+ if (pub_key != NULL && EC_GROUP_cmp(key->group, pub_key->group, NULL) != 0) { | ||
OPENSSL_PUT_ERROR(EC, EC_R_GROUP_MISMATCH); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters