summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-11-09 11:39:13 +0000
committertb <>2023-11-09 11:39:13 +0000
commitcfc71efe3ee903a6ff5fa8718fbf64dc3adecb0d (patch)
tree7d101e1332c49a19d2af91f1fa9f5eeea5d65908
parent8168041edca12c1a863aa3305f368349dd1afb7b (diff)
downloadopenbsd-cfc71efe3ee903a6ff5fa8718fbf64dc3adecb0d.tar.gz
openbsd-cfc71efe3ee903a6ff5fa8718fbf64dc3adecb0d.tar.bz2
openbsd-cfc71efe3ee903a6ff5fa8718fbf64dc3adecb0d.zip
Convert ecx_item_sign() to X509_ALGOR_set0_by_nid()
ok jca
-rw-r--r--src/lib/libcrypto/ec/ecx_methods.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ec/ecx_methods.c b/src/lib/libcrypto/ec/ecx_methods.c
index 4bb8b786a1..75988d99ad 100644
--- a/src/lib/libcrypto/ec/ecx_methods.c
+++ b/src/lib/libcrypto/ec/ecx_methods.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecx_methods.c,v 1.9 2023/07/22 19:33:25 tb Exp $ */ 1/* $OpenBSD: ecx_methods.c,v 1.10 2023/11/09 11:39:13 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -27,6 +27,7 @@
27#include "bytestring.h" 27#include "bytestring.h"
28#include "curve25519_internal.h" 28#include "curve25519_internal.h"
29#include "evp_local.h" 29#include "evp_local.h"
30#include "x509_local.h"
30 31
31/* 32/*
32 * EVP PKEY and PKEY ASN.1 methods Ed25519 and X25519. 33 * EVP PKEY and PKEY ASN.1 methods Ed25519 and X25519.
@@ -729,16 +730,12 @@ static int
729ecx_item_sign(EVP_MD_CTX *md_ctx, const ASN1_ITEM *it, void *asn, 730ecx_item_sign(EVP_MD_CTX *md_ctx, const ASN1_ITEM *it, void *asn,
730 X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *abs) 731 X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *abs)
731{ 732{
732 ASN1_OBJECT *aobj; 733 if (!X509_ALGOR_set0_by_nid(algor1, NID_ED25519, V_ASN1_UNDEF, NULL))
733
734 if ((aobj = OBJ_nid2obj(NID_ED25519)) == NULL)
735 return 0;
736
737 if (!X509_ALGOR_set0(algor1, aobj, V_ASN1_UNDEF, NULL))
738 return 0; 734 return 0;
739 735
740 if (algor2 != NULL) { 736 if (algor2 != NULL) {
741 if (!X509_ALGOR_set0(algor2, aobj, V_ASN1_UNDEF, NULL)) 737 if (!X509_ALGOR_set0_by_nid(algor2, NID_ED25519, V_ASN1_UNDEF,
738 NULL))
742 return 0; 739 return 0;
743 } 740 }
744 741