Skip to content

Commit

Permalink
let ECDSA_verify return -1 for ASN1 parsing fail
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel40791765 committed Oct 18, 2024
1 parent 54fc7b7 commit 8f55a2a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crypto/fipsmodule/ecdsa/ecdsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ int ECDSA_sign(int type, const uint8_t *digest, size_t digest_len, uint8_t *sig,
int ECDSA_verify(int type, const uint8_t *digest, size_t digest_len,
const uint8_t *sig, size_t sig_len, const EC_KEY *eckey) {
ECDSA_SIG *s;
int ret = 0;
int ret = -1;
uint8_t *der = NULL;

// Decode the ECDSA signature.
Expand Down
4 changes: 2 additions & 2 deletions include/openssl/ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ OPENSSL_EXPORT int ECDSA_sign(int type, const uint8_t *digest,

// ECDSA_verify verifies that |sig_len| bytes from |sig| constitute a valid
// signature by |key| of |digest|. (The |type| argument should be zero.) It
// returns one on success or zero if the signature is invalid or an error
// occurred.
// returns one on success or zero if the signature is invalid. It returns -1
// if any other error has occurred such as invalid ASN1 input.
//
// WARNING: |digest| must be the output of some hash function on the data to be
// verified. Passing unhashed inputs will not result in a secure signature
Expand Down

0 comments on commit 8f55a2a

Please sign in to comment.