summaryrefslogtreecommitdiff
path: root/crypto/ec/ec_key.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-02-23 15:02:34 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-02-28 22:54:53 +0000
commit4b0555ec9d322abec2ddf769387e1228dc9a440b (patch)
tree1cb0b0154252da3c40fe13aa6e15b2b3ae91609a /crypto/ec/ec_key.c
parent8dcfdbf510085fd5740abe78f1f8ca120b475f05 (diff)
downloadopenssl-new-4b0555ec9d322abec2ddf769387e1228dc9a440b.tar.gz
Add no signing flag.
Add a flag to EC_METHOD for curves which do not support signing. New function EC_KEY_can_sign() returns 1 is key can be used for signing. Return an explicit error is an attempt is made to sign with no signing curves. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
Diffstat (limited to 'crypto/ec/ec_key.c')
-rw-r--r--crypto/ec/ec_key.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index f09edbbc05..e59d2c6d6a 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -631,3 +631,11 @@ size_t EC_KEY_priv2buf(const EC_KEY *eckey, unsigned char **pbuf)
*pbuf = buf;
return len;
}
+
+int EC_KEY_can_sign(const EC_KEY *eckey)
+{
+ if (eckey->group == NULL || eckey->group->meth == NULL
+ || (eckey->group->meth->flags & EC_FLAGS_NO_SIGN))
+ return 0;
+ return 1;
+}