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 5a45454..f3c6d78 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 "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)
 {
 
 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);
 {
     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;
 }
 
     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);
 {
     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;
 }
     return 0;
 }
index ef8c66f..a62b999 100644 (file)
@@ -62,6 +62,7 @@
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
 #ifndef OPENSSL_NO_ENGINE
 # include <openssl/engine.h>
 #endif
+#include <openssl/err.h>
 
 /*-
  * returns
 
 /*-
  * 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);
 {
     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;
 }
 
     return 0;
 }
 
index b770507..ed1fea9 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_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
 # define EC_F_ECDSA_SIGN_SETUP                            248
 # define EC_F_ECKEY_PARAM2TYPE                            223
 # define EC_F_ECKEY_PARAM_DECODE                          212