return errors for unsupported operations
authorDr. Stephen Henson <steve@openssl.org>
Tue, 27 Oct 2015 19:18:59 +0000 (19:18 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 9 Dec 2015 22:09:19 +0000 (22:09 +0000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/ec/ecdsa_sign.c
crypto/ec/ecdsa_vrf.c
include/openssl/ec.h

index 5a45454e8901026c83094a051f37e3ce3236cb1d..f3c6d7871c5c42c190aa730aa4b2328b13a84328 100644 (file)
  *
  */
 
-# include <openssl/ec.h>
+#include <openssl/ec.h>
 #include "ec_lcl.h"
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
 #include <openssl/rand.h>
+#include <openssl/err.h>
 
 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;
 }
index ef8c66f448ea1a6e977dafa8d06a2922e03de46c..a62b999bb994bee6d08a4da2b07e6f23113ef210 100644 (file)
@@ -62,6 +62,7 @@
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
+#include <openssl/err.h>
 
 /*-
  * 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;
 }
 
index b7705070174fcd3a2ec616018cdda2dff013c11e..ed1fea95753af1a637e7c90ba3e4e2b00542df3c 100644 (file)
@@ -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