From: tb Date: Wed, 11 Oct 2023 13:00:16 +0000 (+0000) Subject: Add preallocation dance for X509_ALGOR_set_md() as documented X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7e2b1f45a2fe35c726aa5e21279814a524fd4529;p=openbsd Add preallocation dance for X509_ALGOR_set_md() as documented --- diff --git a/regress/lib/libcrypto/asn1/x509_algor.c b/regress/lib/libcrypto/asn1/x509_algor.c index 6e0e6512211..6f53c3d034c 100644 --- a/regress/lib/libcrypto/asn1/x509_algor.c +++ b/regress/lib/libcrypto/asn1/x509_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_algor.c,v 1.1 2023/10/11 12:49:00 tb Exp $ */ +/* $OpenBSD: x509_algor.c,v 1.2 2023/10/11 13:00:16 tb Exp $ */ /* * Copyright (c) 2023 Theo Buehler * @@ -339,6 +339,10 @@ x509_algor_set_md_test(void) goto failure; } + /* Preallocate as recommended in the manual. */ + if (!X509_ALGOR_set0(alg, NULL, 0, NULL)) + errx(1, "%s: X509_ALGOR_set0", __func__); + X509_ALGOR_set_md(alg, EVP_md5()); X509_ALGOR_get0(&aobj, &ptype, NULL, alg); if ((nid = OBJ_obj2nid(aobj)) != NID_md5) {