summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ecdsa/ecs_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/ecdsa/ecs_sign.c')
-rw-r--r--lib/libcrypto/ecdsa/ecs_sign.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/lib/libcrypto/ecdsa/ecs_sign.c b/lib/libcrypto/ecdsa/ecs_sign.c
index 55bb02d57fa..029a0cb562c 100644
--- a/lib/libcrypto/ecdsa/ecs_sign.c
+++ b/lib/libcrypto/ecdsa/ecs_sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecs_sign.c,v 1.5 2014/10/18 17:20:40 jsing Exp $ */
+/* $OpenBSD: ecs_sign.c,v 1.6 2015/02/08 13:35:07 jsing Exp $ */
/* ====================================================================
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
*
@@ -7,7 +7,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -60,35 +60,39 @@
#include <openssl/engine.h>
#endif
-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)
{
return ECDSA_do_sign_ex(dgst, dlen, NULL, NULL, eckey);
}
-ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dlen,
- const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey)
+ECDSA_SIG *
+ECDSA_do_sign_ex(const unsigned char *dgst, int dlen, const BIGNUM *kinv,
+ const BIGNUM *rp, EC_KEY *eckey)
{
ECDSA_DATA *ecdsa = ecdsa_check(eckey);
+
if (ecdsa == NULL)
return NULL;
return ecdsa->meth->ecdsa_do_sign(dgst, dlen, kinv, rp, eckey);
}
-int ECDSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char
- *sig, unsigned int *siglen, EC_KEY *eckey)
+int
+ECDSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
+ unsigned int *siglen, EC_KEY *eckey)
{
return ECDSA_sign_ex(type, dgst, dlen, sig, siglen, NULL, NULL, eckey);
}
-int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char
- *sig, unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r,
- EC_KEY *eckey)
+int
+ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
+ unsigned int *siglen, const BIGNUM *kinv, const BIGNUM *r, EC_KEY *eckey)
{
ECDSA_SIG *s;
+
s = ECDSA_do_sign_ex(dgst, dlen, kinv, r, eckey);
- if (s == NULL)
- {
- *siglen=0;
+ if (s == NULL) {
+ *siglen = 0;
return 0;
}
*siglen = i2d_ECDSA_SIG(s, &sig);
@@ -96,11 +100,12 @@ int ECDSA_sign_ex(int type, const unsigned char *dgst, int dlen, unsigned char
return 1;
}
-int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp,
- BIGNUM **rp)
+int
+ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
{
ECDSA_DATA *ecdsa = ecdsa_check(eckey);
+
if (ecdsa == NULL)
return 0;
- return ecdsa->meth->ecdsa_sign_setup(eckey, ctx_in, kinvp, rp);
+ return ecdsa->meth->ecdsa_sign_setup(eckey, ctx_in, kinvp, rp);
}