diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch new file mode 100644 index 000000000..d4c6a3847 --- /dev/null +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/ipmi/phosphor-ipmi-net/0012-crypt_algo-Null-check-on-Cipher-context.patch @@ -0,0 +1,47 @@ +From 0b1184586b34ae40976e307d30fc44c3ed71dc11 Mon Sep 17 00:00:00 2001 +From: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +Date: Fri, 25 Jun 2021 20:23:26 +0530 +Subject: [PATCH] crypt_algo: Null check on Cipher context + +There is no Null check performed while creating a new +Cipher contex. OPENSSL_zalloc can return NULL. + +Tested: No regression observed + +Change-Id: Ibc135adf9a20783c72116587ed3c45e3d457b3ad +Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> +--- + crypt_algo.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/crypt_algo.cpp b/crypt_algo.cpp +index c51465f..d5be1cb 100644 +--- a/crypt_algo.cpp ++++ b/crypt_algo.cpp +@@ -103,6 +103,11 @@ std::vector<uint8_t> AlgoAES128::decryptData(const uint8_t* iv, + // Initializes Cipher context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + ++ if (!ctx) ++ { ++ throw std::runtime_error("EVP_CIPHER_CTX failed"); ++ } ++ + auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); }; + + std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx, +@@ -164,6 +169,11 @@ std::vector<uint8_t> AlgoAES128::encryptData(const uint8_t* input, + // Initializes Cipher context + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + ++ if (!ctx) ++ { ++ throw std::runtime_error("EVP_CIPHER_CTX failed"); ++ } ++ + auto cleanupFunc = [](EVP_CIPHER_CTX* ctx) { EVP_CIPHER_CTX_free(ctx); }; + + std::unique_ptr<EVP_CIPHER_CTX, decltype(cleanupFunc)> ctxPtr(ctx, +-- +2.17.1 + |