From f0ebda6da59c68388b2e5faeb0d8c837539d51bc Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 22 Mar 2023 14:35:22 +0100 Subject: [PATCH] src/openssl/internal.h: Adding signature serialize/unserialize function definitions. --- src/openssl/internal.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/openssl/internal.h b/src/openssl/internal.h index 87bd979..9a5d6c1 100644 --- a/src/openssl/internal.h +++ b/src/openssl/internal.h @@ -40,6 +40,24 @@ int calculate_pubkey(const EC_GROUP *group, const EC_KEY *ec_key, EC_POINT **poi int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, const BIGNUM* r, const BIGNUM* s, const unsigned char *msg, int msglen, int recid, int check); +/** + * Signature serialization function. + * sig must be a pointer to a serialized signature and be atleast 65 (32s + 32 + 1) bytes long. + * + * returns -1 if there was an error. zero otherwise. + */ +int ECDSA_SIG_serialize(const ECDSA_SIG *ecdsa_sig, int recid, unsigned char* sig); + +/** + * Signature unserialization functions. + * sig must be a pointer to a serialized signature and be atleast 65 (32s + 32 + 1) bytes long. + * + * returns -1 if there was an error. zero otherwise. + */ +int ECDSA_SIG_unserialize(const unsigned char *sig, ECDSA_SIG *ecdsa_sig, int *recid); + +int ECDSA_SIG_unserialize_rs(const unsigned char *sig, BIGNUM **r, BIGNUM **s, int *recid); + #ifdef __cplusplus } #endif