openssl: A potential NPD bug

In openssl 1.1.0, in the source file engines/e_dasync.c, there is a potential NPD bug. image

In Line 757, EVP_aes_128_cbc_hmac_sha1() function may return null, and then is passed to the function call to dasync_cipher_init_key_helper as the fifth parameter. Later, it will be dereferenced in the source file engines/e_dasync.c at Line 638.

image

image image

Would you help to confirm whether this is a true bug? Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Actually I don’t think this is a false positive. This test case caues a SEGFAULT when run with OPENSSL_ia32cap=0:

#include <openssl/engine.h>
#include <openssl/evp.h>

int main()
{
  ENGINE *e;
  const EVP_CIPHER * cipher;
  EVP_CIPHER_CTX *ctx;

  OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL);
  e = ENGINE_by_id("dasync");
  if (e == NULL)
    return 1;
  ENGINE_init(e);
  cipher = ENGINE_get_cipher(e, NID_aes_128_cbc_hmac_sha1);
  ctx = EVP_CIPHER_CTX_new();
  if (cipher != NULL && ctx != NULL)
    {
       int rv = EVP_EncryptInit_ex(ctx, cipher, e, NULL, NULL);
       printf("EncryptInit=%d\n", rv);
    }
  EVP_CIPHER_CTX_free(ctx);
  ENGINE_finish(e);
  ENGINE_remove(e);
  ENGINE_free(e);
  return 0;
}