Skip to content

Commit f10928f

Browse files
authored
crypto: use X509_ALGOR accessors instead of reaching into X509_ALGOR
While the struct is still public in OpenSSL, there is a (somewhat inconvenient) accessor. Use it to remain compatible if it becomes opaque in the future. PR-URL: #50057 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 76004f3 commit f10928f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/crypto/crypto_rsa.cc

+9-3
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,9 @@ Maybe<bool> GetRsaKeyDetail(
577577
int64_t salt_length = 20;
578578

579579
if (params->hashAlgorithm != nullptr) {
580-
hash_nid = OBJ_obj2nid(params->hashAlgorithm->algorithm);
580+
const ASN1_OBJECT* hash_obj;
581+
X509_ALGOR_get0(&hash_obj, nullptr, nullptr, params->hashAlgorithm);
582+
hash_nid = OBJ_obj2nid(hash_obj);
581583
}
582584

583585
if (target
@@ -590,9 +592,13 @@ Maybe<bool> GetRsaKeyDetail(
590592
}
591593

592594
if (params->maskGenAlgorithm != nullptr) {
593-
mgf_nid = OBJ_obj2nid(params->maskGenAlgorithm->algorithm);
595+
const ASN1_OBJECT* mgf_obj;
596+
X509_ALGOR_get0(&mgf_obj, nullptr, nullptr, params->maskGenAlgorithm);
597+
mgf_nid = OBJ_obj2nid(mgf_obj);
594598
if (mgf_nid == NID_mgf1) {
595-
mgf1_hash_nid = OBJ_obj2nid(params->maskHash->algorithm);
599+
const ASN1_OBJECT* mgf1_hash_obj;
600+
X509_ALGOR_get0(&mgf1_hash_obj, nullptr, nullptr, params->maskHash);
601+
mgf1_hash_nid = OBJ_obj2nid(mgf1_hash_obj);
596602
}
597603
}
598604

0 commit comments

Comments
 (0)