From 4b0555ec9d322abec2ddf769387e1228dc9a440b Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Tue, 23 Feb 2016 15:02:34 +0000 Subject: Add no signing flag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Emilia Käsper --- crypto/ec/ec_key.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'crypto/ec/ec_key.c') 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; +} -- cgit v1.2.1