mac poly1305: add missing NULL check in new function.
authorPauli <paul.dale@oracle.com>
Wed, 11 Dec 2019 21:34:46 +0000 (07:34 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 13 Dec 2019 00:31:28 +0000 (10:31 +1000)
Bug reported by Kihong Heo.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10613)

providers/implementations/macs/poly1305_prov.c

index 9507046..1edd2dc 100644 (file)
@@ -45,7 +45,8 @@ static void *poly1305_new(void *provctx)
 {
     struct poly1305_data_st *ctx = OPENSSL_zalloc(sizeof(*ctx));
 
-    ctx->provctx = provctx;
+    if (ctx != NULL)
+        ctx->provctx = provctx;
     return ctx;
 }