From 74c53fc16a175d873dec668b929003706f69faa8 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 9 Nov 2023 11:36:39 +0000 Subject: [PATCH] Convert asn1_item_sign() to X509_ALGOR_set0_by_nid() ok jca --- lib/libcrypto/asn1/asn1_item.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/libcrypto/asn1/asn1_item.c b/lib/libcrypto/asn1/asn1_item.c index 87f426c6f86..3f67e3fc36c 100644 --- a/lib/libcrypto/asn1/asn1_item.c +++ b/lib/libcrypto/asn1/asn1_item.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_item.c,v 1.17 2023/07/13 20:59:10 tb Exp $ */ +/* $OpenBSD: asn1_item.c,v 1.18 2023/11/09 11:36:39 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -118,6 +118,7 @@ #include "asn1_local.h" #include "evp_local.h" +#include "x509_local.h" int ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, @@ -235,7 +236,6 @@ asn1_item_set_algorithm_identifiers(EVP_MD_CTX *ctx, X509_ALGOR *algor1, X509_ALGOR *algor2) { EVP_PKEY *pkey; - ASN1_OBJECT *aobj; const EVP_MD *md; int sign_id, sign_param; @@ -254,21 +254,17 @@ asn1_item_set_algorithm_identifiers(EVP_MD_CTX *ctx, X509_ALGOR *algor1, ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED); return 0; } - if ((aobj = OBJ_nid2obj(sign_id)) == NULL) { - ASN1error(ASN1_R_UNKNOWN_OBJECT_TYPE); - return 0; - } sign_param = V_ASN1_UNDEF; if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL) sign_param = V_ASN1_NULL; if (algor1 != NULL) { - if (!X509_ALGOR_set0(algor1, aobj, sign_param, NULL)) + if (!X509_ALGOR_set0_by_nid(algor1, sign_id, sign_param, NULL)) return 0; } if (algor2 != NULL) { - if (!X509_ALGOR_set0(algor2, aobj, sign_param, NULL)) + if (!X509_ALGOR_set0_by_nid(algor2, sign_id, sign_param, NULL)) return 0; } -- 2.20.1