diff options
| author | tb <> | 2023-11-09 11:36:39 +0000 |
|---|---|---|
| committer | tb <> | 2023-11-09 11:36:39 +0000 |
| commit | 0ef683cb4eb043dab7880a33e01720e6709579b6 (patch) | |
| tree | 53a8ae6112010e3d16fefa6d4a48bbb1cc123f98 /src/lib/libc | |
| parent | f4de482637e4d61f59303836548839990a5d26a7 (diff) | |
| download | openbsd-0ef683cb4eb043dab7880a33e01720e6709579b6.tar.gz openbsd-0ef683cb4eb043dab7880a33e01720e6709579b6.tar.bz2 openbsd-0ef683cb4eb043dab7880a33e01720e6709579b6.zip | |
Convert asn1_item_sign() to X509_ALGOR_set0_by_nid()
ok jca
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_item.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c index 87f426c6f8..3f67e3fc36 100644 --- a/src/lib/libcrypto/asn1/asn1_item.c +++ b/src/lib/libcrypto/asn1/asn1_item.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_item.c,v 1.17 2023/07/13 20:59:10 tb Exp $ */ | 1 | /* $OpenBSD: asn1_item.c,v 1.18 2023/11/09 11:36:39 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -118,6 +118,7 @@ | |||
| 118 | 118 | ||
| 119 | #include "asn1_local.h" | 119 | #include "asn1_local.h" |
| 120 | #include "evp_local.h" | 120 | #include "evp_local.h" |
| 121 | #include "x509_local.h" | ||
| 121 | 122 | ||
| 122 | int | 123 | int |
| 123 | ASN1_item_digest(const ASN1_ITEM *it, const EVP_MD *type, void *asn, | 124 | 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, | |||
| 235 | X509_ALGOR *algor2) | 236 | X509_ALGOR *algor2) |
| 236 | { | 237 | { |
| 237 | EVP_PKEY *pkey; | 238 | EVP_PKEY *pkey; |
| 238 | ASN1_OBJECT *aobj; | ||
| 239 | const EVP_MD *md; | 239 | const EVP_MD *md; |
| 240 | int sign_id, sign_param; | 240 | int sign_id, sign_param; |
| 241 | 241 | ||
| @@ -254,21 +254,17 @@ asn1_item_set_algorithm_identifiers(EVP_MD_CTX *ctx, X509_ALGOR *algor1, | |||
| 254 | ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED); | 254 | ASN1error(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED); |
| 255 | return 0; | 255 | return 0; |
| 256 | } | 256 | } |
| 257 | if ((aobj = OBJ_nid2obj(sign_id)) == NULL) { | ||
| 258 | ASN1error(ASN1_R_UNKNOWN_OBJECT_TYPE); | ||
| 259 | return 0; | ||
| 260 | } | ||
| 261 | 257 | ||
| 262 | sign_param = V_ASN1_UNDEF; | 258 | sign_param = V_ASN1_UNDEF; |
| 263 | if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL) | 259 | if (pkey->ameth->pkey_flags & ASN1_PKEY_SIGPARAM_NULL) |
| 264 | sign_param = V_ASN1_NULL; | 260 | sign_param = V_ASN1_NULL; |
| 265 | 261 | ||
| 266 | if (algor1 != NULL) { | 262 | if (algor1 != NULL) { |
| 267 | if (!X509_ALGOR_set0(algor1, aobj, sign_param, NULL)) | 263 | if (!X509_ALGOR_set0_by_nid(algor1, sign_id, sign_param, NULL)) |
| 268 | return 0; | 264 | return 0; |
| 269 | } | 265 | } |
| 270 | if (algor2 != NULL) { | 266 | if (algor2 != NULL) { |
| 271 | if (!X509_ALGOR_set0(algor2, aobj, sign_param, NULL)) | 267 | if (!X509_ALGOR_set0_by_nid(algor2, sign_id, sign_param, NULL)) |
| 272 | return 0; | 268 | return 0; |
| 273 | } | 269 | } |
| 274 | 270 | ||
