1*de0e0e4dSAntonio Huete Jimenez /* $OpenBSD: ecdsa.h,v 1.12 2022/07/12 14:42:49 kn Exp $ */ 2f5b1c8a1SJohn Marino /** 3f5b1c8a1SJohn Marino * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions 4f5b1c8a1SJohn Marino * \author Written by Nils Larsch for the OpenSSL project 5f5b1c8a1SJohn Marino */ 6f5b1c8a1SJohn Marino /* ==================================================================== 7f5b1c8a1SJohn Marino * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. 8f5b1c8a1SJohn Marino * 9f5b1c8a1SJohn Marino * Redistribution and use in source and binary forms, with or without 10f5b1c8a1SJohn Marino * modification, are permitted provided that the following conditions 11f5b1c8a1SJohn Marino * are met: 12f5b1c8a1SJohn Marino * 13f5b1c8a1SJohn Marino * 1. Redistributions of source code must retain the above copyright 14f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer. 15f5b1c8a1SJohn Marino * 16f5b1c8a1SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 17f5b1c8a1SJohn Marino * notice, this list of conditions and the following disclaimer in 18f5b1c8a1SJohn Marino * the documentation and/or other materials provided with the 19f5b1c8a1SJohn Marino * distribution. 20f5b1c8a1SJohn Marino * 21f5b1c8a1SJohn Marino * 3. All advertising materials mentioning features or use of this 22f5b1c8a1SJohn Marino * software must display the following acknowledgment: 23f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 24f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25f5b1c8a1SJohn Marino * 26f5b1c8a1SJohn Marino * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27f5b1c8a1SJohn Marino * endorse or promote products derived from this software without 28f5b1c8a1SJohn Marino * prior written permission. For written permission, please contact 29f5b1c8a1SJohn Marino * licensing@OpenSSL.org. 30f5b1c8a1SJohn Marino * 31f5b1c8a1SJohn Marino * 5. Products derived from this software may not be called "OpenSSL" 32f5b1c8a1SJohn Marino * nor may "OpenSSL" appear in their names without prior written 33f5b1c8a1SJohn Marino * permission of the OpenSSL Project. 34f5b1c8a1SJohn Marino * 35f5b1c8a1SJohn Marino * 6. Redistributions of any form whatsoever must retain the following 36f5b1c8a1SJohn Marino * acknowledgment: 37f5b1c8a1SJohn Marino * "This product includes software developed by the OpenSSL Project 38f5b1c8a1SJohn Marino * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39f5b1c8a1SJohn Marino * 40f5b1c8a1SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41f5b1c8a1SJohn Marino * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42f5b1c8a1SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43f5b1c8a1SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44f5b1c8a1SJohn Marino * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45f5b1c8a1SJohn Marino * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46f5b1c8a1SJohn Marino * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47f5b1c8a1SJohn Marino * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48f5b1c8a1SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49f5b1c8a1SJohn Marino * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50f5b1c8a1SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51f5b1c8a1SJohn Marino * OF THE POSSIBILITY OF SUCH DAMAGE. 52f5b1c8a1SJohn Marino * ==================================================================== 53f5b1c8a1SJohn Marino * 54f5b1c8a1SJohn Marino * This product includes cryptographic software written by Eric Young 55f5b1c8a1SJohn Marino * (eay@cryptsoft.com). This product includes software written by Tim 56f5b1c8a1SJohn Marino * Hudson (tjh@cryptsoft.com). 57f5b1c8a1SJohn Marino * 58f5b1c8a1SJohn Marino */ 59f5b1c8a1SJohn Marino #ifndef HEADER_ECDSA_H 60f5b1c8a1SJohn Marino #define HEADER_ECDSA_H 61f5b1c8a1SJohn Marino 62f5b1c8a1SJohn Marino #include <openssl/opensslconf.h> 63f5b1c8a1SJohn Marino 64f5b1c8a1SJohn Marino #ifdef OPENSSL_NO_ECDSA 65f5b1c8a1SJohn Marino #error ECDSA is disabled. 66f5b1c8a1SJohn Marino #endif 67f5b1c8a1SJohn Marino 68f5b1c8a1SJohn Marino #include <openssl/ec.h> 69f5b1c8a1SJohn Marino #include <openssl/ossl_typ.h> 70f5b1c8a1SJohn Marino #ifndef OPENSSL_NO_DEPRECATED 71f5b1c8a1SJohn Marino #include <openssl/bn.h> 72f5b1c8a1SJohn Marino #endif 73f5b1c8a1SJohn Marino 74f5b1c8a1SJohn Marino #ifdef __cplusplus 75f5b1c8a1SJohn Marino extern "C" { 76f5b1c8a1SJohn Marino #endif 77f5b1c8a1SJohn Marino 78f5b1c8a1SJohn Marino typedef struct ECDSA_SIG_st ECDSA_SIG; 79f5b1c8a1SJohn Marino 80f5b1c8a1SJohn Marino struct ecdsa_method { 81f5b1c8a1SJohn Marino const char *name; 82f5b1c8a1SJohn Marino ECDSA_SIG *(*ecdsa_do_sign)(const unsigned char *dgst, int dgst_len, 83f5b1c8a1SJohn Marino const BIGNUM *inv, const BIGNUM *rp, EC_KEY *eckey); 84f5b1c8a1SJohn Marino int (*ecdsa_sign_setup)(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, 85f5b1c8a1SJohn Marino BIGNUM **r); 86f5b1c8a1SJohn Marino int (*ecdsa_do_verify)(const unsigned char *dgst, int dgst_len, 87f5b1c8a1SJohn Marino const ECDSA_SIG *sig, EC_KEY *eckey); 88f5b1c8a1SJohn Marino int flags; 89f5b1c8a1SJohn Marino char *app_data; 90f5b1c8a1SJohn Marino }; 91f5b1c8a1SJohn Marino 92f5b1c8a1SJohn Marino /* If this flag is set the ECDSA method is FIPS compliant and can be used 93f5b1c8a1SJohn Marino * in FIPS mode. This is set in the validated module method. If an 94f5b1c8a1SJohn Marino * application sets this flag in its own methods it is its responsibility 95f5b1c8a1SJohn Marino * to ensure the result is compliant. 96f5b1c8a1SJohn Marino */ 97f5b1c8a1SJohn Marino 98f5b1c8a1SJohn Marino #define ECDSA_FLAG_FIPS_METHOD 0x1 99f5b1c8a1SJohn Marino 100f5b1c8a1SJohn Marino /** Allocates and initialize a ECDSA_SIG structure 101f5b1c8a1SJohn Marino * \return pointer to a ECDSA_SIG structure or NULL if an error occurred 102f5b1c8a1SJohn Marino */ 103f5b1c8a1SJohn Marino ECDSA_SIG *ECDSA_SIG_new(void); 104f5b1c8a1SJohn Marino 105f5b1c8a1SJohn Marino /** frees a ECDSA_SIG structure 106f5b1c8a1SJohn Marino * \param sig pointer to the ECDSA_SIG structure 107f5b1c8a1SJohn Marino */ 108f5b1c8a1SJohn Marino void ECDSA_SIG_free(ECDSA_SIG *sig); 109f5b1c8a1SJohn Marino 110f5b1c8a1SJohn Marino /** DER encode content of ECDSA_SIG object (note: this function modifies *pp 111f5b1c8a1SJohn Marino * (*pp += length of the DER encoded signature)). 112f5b1c8a1SJohn Marino * \param sig pointer to the ECDSA_SIG object 113f5b1c8a1SJohn Marino * \param pp pointer to a unsigned char pointer for the output or NULL 114f5b1c8a1SJohn Marino * \return the length of the DER encoded ECDSA_SIG object or 0 115f5b1c8a1SJohn Marino */ 116f5b1c8a1SJohn Marino int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); 117f5b1c8a1SJohn Marino 118f5b1c8a1SJohn Marino /** Decodes a DER encoded ECDSA signature (note: this function changes *pp 119f5b1c8a1SJohn Marino * (*pp += len)). 120f5b1c8a1SJohn Marino * \param sig pointer to ECDSA_SIG pointer (may be NULL) 121f5b1c8a1SJohn Marino * \param pp memory buffer with the DER encoded signature 122f5b1c8a1SJohn Marino * \param len length of the buffer 123f5b1c8a1SJohn Marino * \return pointer to the decoded ECDSA_SIG structure (or NULL) 124f5b1c8a1SJohn Marino */ 125f5b1c8a1SJohn Marino ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); 126f5b1c8a1SJohn Marino 12772c33676SMaxim Ag /** Accessor for r and s fields of ECDSA_SIG 12872c33676SMaxim Ag * \param sig pointer to ECDSA_SIG pointer 12972c33676SMaxim Ag * \param pr pointer to BIGNUM pointer for r (may be NULL) 13072c33676SMaxim Ag * \param ps pointer to BIGNUM pointer for s (may be NULL) 13172c33676SMaxim Ag */ 13272c33676SMaxim Ag void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); 13372c33676SMaxim Ag 134*de0e0e4dSAntonio Huete Jimenez const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); 135*de0e0e4dSAntonio Huete Jimenez const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); 136*de0e0e4dSAntonio Huete Jimenez 13772c33676SMaxim Ag /** Setter for r and s fields of ECDSA_SIG 13872c33676SMaxim Ag * \param sig pointer to ECDSA_SIG pointer 13972c33676SMaxim Ag * \param r pointer to BIGNUM for r (may be NULL) 14072c33676SMaxim Ag * \param s pointer to BIGNUM for s (may be NULL) 14172c33676SMaxim Ag */ 14272c33676SMaxim Ag int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); 14372c33676SMaxim Ag 144f5b1c8a1SJohn Marino /** Computes the ECDSA signature of the given hash value using 145f5b1c8a1SJohn Marino * the supplied private key and returns the created signature. 146f5b1c8a1SJohn Marino * \param dgst pointer to the hash value 147f5b1c8a1SJohn Marino * \param dgst_len length of the hash value 148f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a private EC key 149f5b1c8a1SJohn Marino * \return pointer to a ECDSA_SIG structure or NULL if an error occurred 150f5b1c8a1SJohn Marino */ 151f5b1c8a1SJohn Marino ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dgst_len, 152f5b1c8a1SJohn Marino EC_KEY *eckey); 153f5b1c8a1SJohn Marino 154f5b1c8a1SJohn Marino /** Computes ECDSA signature of a given hash value using the supplied 155f5b1c8a1SJohn Marino * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). 156f5b1c8a1SJohn Marino * \param dgst pointer to the hash value to sign 157f5b1c8a1SJohn Marino * \param dgstlen length of the hash value 158f5b1c8a1SJohn Marino * \param kinv BIGNUM with a pre-computed inverse k (optional) 159f5b1c8a1SJohn Marino * \param rp BIGNUM with a pre-computed rp value (optioanl), 160f5b1c8a1SJohn Marino * see ECDSA_sign_setup 161f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a private EC key 162f5b1c8a1SJohn Marino * \return pointer to a ECDSA_SIG structure or NULL if an error occurred 163f5b1c8a1SJohn Marino */ 164f5b1c8a1SJohn Marino ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, 165f5b1c8a1SJohn Marino const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey); 166f5b1c8a1SJohn Marino 167f5b1c8a1SJohn Marino /** Verifies that the supplied signature is a valid ECDSA 168f5b1c8a1SJohn Marino * signature of the supplied hash value using the supplied public key. 169f5b1c8a1SJohn Marino * \param dgst pointer to the hash value 170f5b1c8a1SJohn Marino * \param dgst_len length of the hash value 171f5b1c8a1SJohn Marino * \param sig ECDSA_SIG structure 172f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a public EC key 173f5b1c8a1SJohn Marino * \return 1 if the signature is valid, 0 if the signature is invalid 174f5b1c8a1SJohn Marino * and -1 on error 175f5b1c8a1SJohn Marino */ 176f5b1c8a1SJohn Marino int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, 177f5b1c8a1SJohn Marino const ECDSA_SIG *sig, EC_KEY* eckey); 178f5b1c8a1SJohn Marino 179f5b1c8a1SJohn Marino const ECDSA_METHOD *ECDSA_OpenSSL(void); 180f5b1c8a1SJohn Marino 181f5b1c8a1SJohn Marino /** Sets the default ECDSA method 182f5b1c8a1SJohn Marino * \param meth new default ECDSA_METHOD 183f5b1c8a1SJohn Marino */ 184f5b1c8a1SJohn Marino void ECDSA_set_default_method(const ECDSA_METHOD *meth); 185f5b1c8a1SJohn Marino 186f5b1c8a1SJohn Marino /** Returns the default ECDSA method 187f5b1c8a1SJohn Marino * \return pointer to ECDSA_METHOD structure containing the default method 188f5b1c8a1SJohn Marino */ 189f5b1c8a1SJohn Marino const ECDSA_METHOD *ECDSA_get_default_method(void); 190f5b1c8a1SJohn Marino 191f5b1c8a1SJohn Marino /** Sets method to be used for the ECDSA operations 192f5b1c8a1SJohn Marino * \param eckey EC_KEY object 193f5b1c8a1SJohn Marino * \param meth new method 194f5b1c8a1SJohn Marino * \return 1 on success and 0 otherwise 195f5b1c8a1SJohn Marino */ 196f5b1c8a1SJohn Marino int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth); 197f5b1c8a1SJohn Marino 198f5b1c8a1SJohn Marino /** Returns the maximum length of the DER encoded signature 199f5b1c8a1SJohn Marino * \param eckey EC_KEY object 200f5b1c8a1SJohn Marino * \return numbers of bytes required for the DER encoded signature 201f5b1c8a1SJohn Marino */ 202f5b1c8a1SJohn Marino int ECDSA_size(const EC_KEY *eckey); 203f5b1c8a1SJohn Marino 204f5b1c8a1SJohn Marino /** Precompute parts of the signing operation 205f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a private EC key 206f5b1c8a1SJohn Marino * \param ctx BN_CTX object (optional) 207f5b1c8a1SJohn Marino * \param kinv BIGNUM pointer for the inverse of k 208f5b1c8a1SJohn Marino * \param rp BIGNUM pointer for x coordinate of k * generator 209f5b1c8a1SJohn Marino * \return 1 on success and 0 otherwise 210f5b1c8a1SJohn Marino */ 211f5b1c8a1SJohn Marino int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, 212f5b1c8a1SJohn Marino BIGNUM **rp); 213f5b1c8a1SJohn Marino 214f5b1c8a1SJohn Marino /** Computes ECDSA signature of a given hash value using the supplied 215f5b1c8a1SJohn Marino * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). 216f5b1c8a1SJohn Marino * \param type this parameter is ignored 217f5b1c8a1SJohn Marino * \param dgst pointer to the hash value to sign 218f5b1c8a1SJohn Marino * \param dgstlen length of the hash value 219f5b1c8a1SJohn Marino * \param sig memory for the DER encoded created signature 220f5b1c8a1SJohn Marino * \param siglen pointer to the length of the returned signature 221f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a private EC key 222f5b1c8a1SJohn Marino * \return 1 on success and 0 otherwise 223f5b1c8a1SJohn Marino */ 224f5b1c8a1SJohn Marino int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, 225f5b1c8a1SJohn Marino unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); 226f5b1c8a1SJohn Marino 227f5b1c8a1SJohn Marino 228f5b1c8a1SJohn Marino /** Computes ECDSA signature of a given hash value using the supplied 229f5b1c8a1SJohn Marino * private key (note: sig must point to ECDSA_size(eckey) bytes of memory). 230f5b1c8a1SJohn Marino * \param type this parameter is ignored 231f5b1c8a1SJohn Marino * \param dgst pointer to the hash value to sign 232f5b1c8a1SJohn Marino * \param dgstlen length of the hash value 233f5b1c8a1SJohn Marino * \param sig buffer to hold the DER encoded signature 234f5b1c8a1SJohn Marino * \param siglen pointer to the length of the returned signature 235f5b1c8a1SJohn Marino * \param kinv BIGNUM with a pre-computed inverse k (optional) 236f5b1c8a1SJohn Marino * \param rp BIGNUM with a pre-computed rp value (optioanl), 237f5b1c8a1SJohn Marino * see ECDSA_sign_setup 238f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a private EC key 239f5b1c8a1SJohn Marino * \return 1 on success and 0 otherwise 240f5b1c8a1SJohn Marino */ 241f5b1c8a1SJohn Marino int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, 242f5b1c8a1SJohn Marino unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv, 243f5b1c8a1SJohn Marino const BIGNUM *rp, EC_KEY *eckey); 244f5b1c8a1SJohn Marino 245f5b1c8a1SJohn Marino /** Verifies that the given signature is valid ECDSA signature 246f5b1c8a1SJohn Marino * of the supplied hash value using the specified public key. 247f5b1c8a1SJohn Marino * \param type this parameter is ignored 248f5b1c8a1SJohn Marino * \param dgst pointer to the hash value 249f5b1c8a1SJohn Marino * \param dgstlen length of the hash value 250f5b1c8a1SJohn Marino * \param sig pointer to the DER encoded signature 251f5b1c8a1SJohn Marino * \param siglen length of the DER encoded signature 252f5b1c8a1SJohn Marino * \param eckey EC_KEY object containing a public EC key 253f5b1c8a1SJohn Marino * \return 1 if the signature is valid, 0 if the signature is invalid 254f5b1c8a1SJohn Marino * and -1 on error 255f5b1c8a1SJohn Marino */ 256f5b1c8a1SJohn Marino int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, 257f5b1c8a1SJohn Marino const unsigned char *sig, int siglen, EC_KEY *eckey); 258f5b1c8a1SJohn Marino 259f5b1c8a1SJohn Marino /* the standard ex_data functions */ 260f5b1c8a1SJohn Marino int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 261f5b1c8a1SJohn Marino CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 262f5b1c8a1SJohn Marino int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg); 263f5b1c8a1SJohn Marino void *ECDSA_get_ex_data(EC_KEY *d, int idx); 264f5b1c8a1SJohn Marino 265f5b1c8a1SJohn Marino 26672c33676SMaxim Ag /* XXX should be in ec.h, but needs ECDSA_SIG */ 26772c33676SMaxim Ag void EC_KEY_METHOD_set_sign(EC_KEY_METHOD *meth, 26872c33676SMaxim Ag int (*sign)(int type, const unsigned char *dgst, 26972c33676SMaxim Ag int dlen, unsigned char *sig, unsigned int *siglen, 27072c33676SMaxim Ag const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey), 27172c33676SMaxim Ag int (*sign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, 27272c33676SMaxim Ag BIGNUM **kinvp, BIGNUM **rp), 27372c33676SMaxim Ag ECDSA_SIG *(*sign_sig)(const unsigned char *dgst, 27472c33676SMaxim Ag int dgst_len, const BIGNUM *in_kinv, const BIGNUM *in_r, 27572c33676SMaxim Ag EC_KEY *eckey)); 27672c33676SMaxim Ag void EC_KEY_METHOD_set_verify(EC_KEY_METHOD *meth, 27772c33676SMaxim Ag int (*verify)(int type, const unsigned char *dgst, int dgst_len, 27872c33676SMaxim Ag const unsigned char *sigbuf, int sig_len, EC_KEY *eckey), 27972c33676SMaxim Ag int (*verify_sig)(const unsigned char *dgst, int dgst_len, 28072c33676SMaxim Ag const ECDSA_SIG *sig, EC_KEY *eckey)); 28172c33676SMaxim Ag void EC_KEY_METHOD_get_sign(const EC_KEY_METHOD *meth, 28272c33676SMaxim Ag int (**psign)(int type, const unsigned char *dgst, 28372c33676SMaxim Ag int dlen, unsigned char *sig, unsigned int *siglen, 28472c33676SMaxim Ag const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey), 28572c33676SMaxim Ag int (**psign_setup)(EC_KEY *eckey, BN_CTX *ctx_in, 28672c33676SMaxim Ag BIGNUM **kinvp, BIGNUM **rp), 28772c33676SMaxim Ag ECDSA_SIG *(**psign_sig)(const unsigned char *dgst, 28872c33676SMaxim Ag int dgst_len, const BIGNUM *in_kinv, const BIGNUM *in_r, 28972c33676SMaxim Ag EC_KEY *eckey)); 29072c33676SMaxim Ag void EC_KEY_METHOD_get_verify(const EC_KEY_METHOD *meth, 29172c33676SMaxim Ag int (**pverify)(int type, const unsigned char *dgst, int dgst_len, 29272c33676SMaxim Ag const unsigned char *sigbuf, int sig_len, EC_KEY *eckey), 29372c33676SMaxim Ag int (**pverify_sig)(const unsigned char *dgst, int dgst_len, 29472c33676SMaxim Ag const ECDSA_SIG *sig, EC_KEY *eckey)); 29572c33676SMaxim Ag 296f5b1c8a1SJohn Marino void ERR_load_ECDSA_strings(void); 297f5b1c8a1SJohn Marino 298f5b1c8a1SJohn Marino /* Error codes for the ECDSA functions. */ 299f5b1c8a1SJohn Marino 300f5b1c8a1SJohn Marino /* Function codes. */ 301f5b1c8a1SJohn Marino #define ECDSA_F_ECDSA_CHECK 104 302f5b1c8a1SJohn Marino #define ECDSA_F_ECDSA_DATA_NEW_METHOD 100 303f5b1c8a1SJohn Marino #define ECDSA_F_ECDSA_DO_SIGN 101 304f5b1c8a1SJohn Marino #define ECDSA_F_ECDSA_DO_VERIFY 102 305f5b1c8a1SJohn Marino #define ECDSA_F_ECDSA_SIGN_SETUP 103 306f5b1c8a1SJohn Marino 307f5b1c8a1SJohn Marino /* Reason codes. */ 308f5b1c8a1SJohn Marino #define ECDSA_R_BAD_SIGNATURE 100 309f5b1c8a1SJohn Marino #define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101 310f5b1c8a1SJohn Marino #define ECDSA_R_ERR_EC_LIB 102 311f5b1c8a1SJohn Marino #define ECDSA_R_MISSING_PARAMETERS 103 312f5b1c8a1SJohn Marino #define ECDSA_R_NEED_NEW_SETUP_VALUES 106 313f5b1c8a1SJohn Marino #define ECDSA_R_NON_FIPS_METHOD 107 314f5b1c8a1SJohn Marino #define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104 315f5b1c8a1SJohn Marino #define ECDSA_R_SIGNATURE_MALLOC_FAILED 105 316f5b1c8a1SJohn Marino 317f5b1c8a1SJohn Marino #ifdef __cplusplus 318f5b1c8a1SJohn Marino } 319f5b1c8a1SJohn Marino #endif 320f5b1c8a1SJohn Marino #endif 321