Since the potential failure of the OSSL_PROVIDER_load(),
for example there is no lock, the provider could fail to
be loaded into the library context.
Therefore, it should be better to check it and return error
if fails.
Also, in order to avoid free unknown pointer, 'c' should be
initialized as NULL.
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/17729)
int testresult = 0;
unsigned int pad_type = 2;
unsigned char md[MDC2_DIGEST_LENGTH];
- EVP_MD_CTX *c;
+ EVP_MD_CTX *c = NULL;
static char text[] = "Now is the time for all ";
size_t tlen = strlen(text), i = 0;
OSSL_PROVIDER *prov = NULL;
params[i++] = OSSL_PARAM_construct_end();
prov = OSSL_PROVIDER_load(NULL, "legacy");
+ if (!TEST_ptr(prov))
+ goto end;
+
# ifdef CHARSET_EBCDIC
ebcdic2ascii(text, text, tlen);
# endif