CVSROOT:        /cvs
Module name:    src
Changes by:     t...@cvs.openbsd.org    2023/07/13 14:59:10

Modified files:
        lib/libcrypto/asn1: asn1_item.c 

Log message:
Refactor ASN1_item_sign_ctx()

Oh, joy! The muppets had a feast: they could combine the horrors of EVP
with X.509... Return values between -1 and 3 indicating how much work
needs to be done, depending on whether methods are present or absent.
Needless to say that RSA and EdDSA had inconsistent return values until
recently.

Instead of interleaving if/else branches, split out two helper functions
that do essentially independent things, which results in something that
isn't entirely bad. Well, at least not compared to the surrounding code.

asn1_item_set_algorithm_identifiers() extracts the signature algorithm
from the digest and pkey if known, and sets it on the two X509_ALGOR that
may or may not have been passed in.

asn1_item_sign() converts data into der and signs.

Of course there were also a few leaks and missing error checks.

ok jsing

Reply via email to