X509V3_set_ctx(): Clarify use of subject/req parameter for constructing SKID by hash...
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Wed, 10 Nov 2021 08:31:11 +0000 (09:31 +0100)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Tue, 7 Dec 2021 14:13:26 +0000 (15:13 +0100)
This does not change the semantics of expected usage because only either one may be given.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17145)

crypto/x509/v3_skid.c
doc/man3/X509V3_set_ctx.pod

index bab88898e687a2b2a629128b9e1f575372de2b2b..18223f2ef496bbcb5de75777619cf200a3d689fd 100644 (file)
@@ -105,7 +105,7 @@ static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method,
         return NULL;
     }
 
-    return ossl_x509_pubkey_hash(ctx->subject_req != NULL ?
-                                 ctx->subject_req->req_info.pubkey :
-                                 ctx->subject_cert->cert_info.key);
+    return ossl_x509_pubkey_hash(ctx->subject_cert != NULL ?
+                                 ctx->subject_cert->cert_info.key :
+                                 ctx->subject_req->req_info.pubkey);
 }
index 1fc5111de43f545ae0d2cfd9a3719180879c9d65..820052ba984dd511784d961a488a606b71d17fee 100644 (file)
@@ -18,12 +18,14 @@ X509V3_set_issuer_pkey - X.509 v3 extension generation utilities
 X509V3_set_ctx() fills in the basic fields of I<ctx> of type B<X509V3_CTX>,
 providing details potentially needed by functions producing X509 v3 extensions,
 e.g., to look up values for filling in authority key identifiers.
-Any of I<subj>, I<req>, or I<crl> may be provided, pointing to a certificate,
+Any of I<subject>, I<req>, or I<crl> may be provided, pointing to a certificate,
 certification request, or certificate revocation list, respectively.
-If I<subj> or I<crl> is provided, I<issuer> should point to its issuer,
+When constructing the subject key identifier of a certificate by computing a
+hash value of its public key, the public key is taken from I<subject> or I<req>.
+If I<subject> or I<crl> is provided, I<issuer> should point to its issuer,
 for instance to help generating an authority key identifier extension.
-Note that if I<subj> is provided, I<issuer> may be the same as I<subj>,
-which means that I<subj> is self-issued (or even self-signed).
+Note that if I<subject> is provided, I<issuer> may be the same as I<subject>,
+which means that I<subject> is self-issued (or even self-signed).
 I<flags> may be 0
 or contain B<X509V3_CTX_TEST>, which means that just the syntax of
 extension definitions is to be checked without actually producing an extension,