From: Dr. Stephen Henson Date: Tue, 27 Oct 2015 19:18:59 +0000 (+0000) Subject: return errors for unsupported operations X-Git-Tag: OpenSSL_1_1_0-pre1~46 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6e73d12e766b81c91d255b1d5db8b110f5559544;p=oweals%2Fopenssl.git return errors for unsupported operations Reviewed-by: Richard Levitte --- diff --git a/crypto/ec/ecdsa_sign.c b/crypto/ec/ecdsa_sign.c index 5a45454e89..f3c6d7871c 100644 --- a/crypto/ec/ecdsa_sign.c +++ b/crypto/ec/ecdsa_sign.c @@ -53,12 +53,13 @@ * */ -# include +#include #include "ec_lcl.h" #ifndef OPENSSL_NO_ENGINE # include #endif #include +#include ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst, int dlen, EC_KEY *eckey) { @@ -71,6 +72,7 @@ ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, { if (eckey->meth->sign_sig) return eckey->meth->sign_sig(dgst, dlen, kinv, rp, eckey); + ECerr(EC_F_ECDSA_DO_SIGN_EX, EC_R_OPERATION_NOT_SUPPORTED); return NULL; } @@ -101,5 +103,6 @@ int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, { if (eckey->meth->sign_setup) return eckey->meth->sign_setup(eckey, ctx_in, kinvp, rp); + ECerr(EC_F_ECDSA_SIGN_SETUP, EC_R_OPERATION_NOT_SUPPORTED); return 0; } diff --git a/crypto/ec/ecdsa_vrf.c b/crypto/ec/ecdsa_vrf.c index ef8c66f448..a62b999bb9 100644 --- a/crypto/ec/ecdsa_vrf.c +++ b/crypto/ec/ecdsa_vrf.c @@ -62,6 +62,7 @@ #ifndef OPENSSL_NO_ENGINE # include #endif +#include /*- * returns @@ -74,6 +75,7 @@ int ECDSA_do_verify(const unsigned char *dgst, int dgst_len, { if (eckey->meth->verify_sig) return eckey->meth->verify_sig(dgst, dgst_len, sig, eckey); + ECerr(EC_F_ECDSA_DO_VERIFY, EC_R_OPERATION_NOT_SUPPORTED); return 0; } diff --git a/include/openssl/ec.h b/include/openssl/ec.h index b770507017..ed1fea9575 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -1192,6 +1192,8 @@ void ERR_load_EC_strings(void); # define EC_F_ECDH_CMS_DECRYPT 238 # define EC_F_ECDH_CMS_SET_SHARED_INFO 239 # define EC_F_ECDH_COMPUTE_KEY 246 +# define EC_F_ECDSA_DO_SIGN_EX 251 +# define EC_F_ECDSA_DO_VERIFY 252 # define EC_F_ECDSA_SIGN_SETUP 248 # define EC_F_ECKEY_PARAM2TYPE 223 # define EC_F_ECKEY_PARAM_DECODE 212