From 347f3b343ad2e57cfeb77195b304d2ac6fe0abd6 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 11 Oct 2023 13:00:16 +0000 Subject: Add preallocation dance for X509_ALGOR_set_md() as documented --- src/regress/lib/libcrypto/asn1/x509_algor.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/regress/lib/libcrypto/asn1/x509_algor.c b/src/regress/lib/libcrypto/asn1/x509_algor.c index 6e0e651221..6f53c3d034 100644 --- a/src/regress/lib/libcrypto/asn1/x509_algor.c +++ b/src/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) { -- cgit v1.2.3-55-g6feb