/* Do the signature. */
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
md_ctx = EVP_MD_CTX_new();
+ if (!md_ctx)
+ {
+ err = EET_ERROR_OUT_OF_MEMORY;
+ goto on_error;
+ }
EVP_SignInit(md_ctx, EVP_sha1());
EVP_SignUpdate(md_ctx, data, st_buf.st_size);
err = EVP_SignFinal(md_ctx,
/* Verify the signature */
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
md_ctx = EVP_MD_CTX_new();
+ if (!md_ctx)
+ {
+ err = EET_ERROR_OUT_OF_MEMORY;
+
+ X509_free(x509);
+ EVP_PKEY_free(pkey);
+
+ return NULL;
+ }
+
EVP_VerifyInit(md_ctx, EVP_sha1());
EVP_VerifyUpdate(md_ctx, data_base, data_length);
err = EVP_VerifyFinal(md_ctx, sign, sign_len, pkey);
Eina_Slice slice = eina_binbuf_slice_get(data);
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
+ if (!ctx) return EINA_FALSE;
EVP_DigestInit_ex(ctx, md, NULL);
- EVP_DigestUpdate(ctx, slice.mem, slice.len);
+ if (!EVP_DigestUpdate(ctx, slice.mem, slice.len))
+ {
+ EVP_MD_CTX_free(ctx);
+ return EINA_FALSE;
+ }
+
EVP_DigestFinal_ex(ctx, digest, NULL);
EVP_MD_CTX_free(ctx);