openssl: guard against OOM on context creation 75/253775/1 accepted/tizen/base/20210221.221004 submit/tizen_base/20210218.045128
authorDaniel Gustafsson <daniel@yesql.se>
Thu, 19 Nov 2020 00:40:24 +0000 (01:40 +0100)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 18 Feb 2021 02:02:12 +0000 (11:02 +0900)
commitf338b03e4858a6af99cdfaf54ed8b8d6879e5cc1
tree43a67c74fb23764f7e881d65d76c5d2220f8246a
parent811c38c6bbc3f5b718be64f1bcfc05ee28fee1ec
openssl: guard against OOM on context creation

EVP_MD_CTX_create will allocate memory for the context and returns
NULL in case the allocation fails. Make sure to catch any allocation
failures and exit early if so.

In passing, also move to EVP_DigestInit rather than EVP_DigestInit_ex
as the latter is intended for ENGINE selection which we don't do.

Closes #6224

Backported: https://github.com/curl/curl/pull/6224

Change-Id: Ibcd3a0782405d3db6aa08d65892af15c3ea8431b
lib/vtls/openssl.c