From 4371a084ec3ba14e046de3e286ff5fcc855c92dd Mon Sep 17 00:00:00 2001 From: R4SAS Date: Fri, 26 Feb 2021 03:20:06 +0300 Subject: [PATCH] check for pubkey in X25519Keys::Agree Signed-off-by: R4SAS --- libi2pd/Crypto.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libi2pd/Crypto.cpp b/libi2pd/Crypto.cpp index 68850a9d..14ef83ae 100644 --- a/libi2pd/Crypto.cpp +++ b/libi2pd/Crypto.cpp @@ -353,7 +353,7 @@ namespace crypto bool X25519Keys::Agree (const uint8_t * pub, uint8_t * shared) { - if (pub[31] & 0x80) return false; // not x25519 key + if (!pub || (pub[31] & 0x80)) return false; // not x25519 key #if OPENSSL_X25519 EVP_PKEY_derive_init (m_Ctx); auto pkey = EVP_PKEY_new_raw_public_key (EVP_PKEY_X25519, NULL, pub, 32);