aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-12-30 11:11:10 +0100
committerAndreas Schneider <asn@cryptomilk.org>2012-02-04 18:37:04 +0100
commit79383cf8eee729183d88e73d38fcd23a32d67202 (patch)
tree4e8c5d10cd1fee87c63cef42c55405d8239f3aeb
parent33b0cfc199a1f8657a23ae9ce05d2fd4b8261257 (diff)
downloadlibssh-79383cf8eee729183d88e73d38fcd23a32d67202.tar.gz
libssh-79383cf8eee729183d88e73d38fcd23a32d67202.tar.xz
libssh-79383cf8eee729183d88e73d38fcd23a32d67202.zip
pki: Add ecdsa support to do_sign.
-rw-r--r--src/pki_crypto.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 4030d47..772cf23 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -1291,6 +1291,20 @@ ssh_signature pki_do_sign(const ssh_key privkey,
sig->dsa_sig = NULL;
break;
case SSH_KEYTYPE_ECDSA:
+#ifdef HAVE_OPENSSL_ECC
+ sig->ecdsa_sig = ECDSA_do_sign(hash, hlen, privkey->ecdsa);
+ if (sig->ecdsa_sig == NULL) {
+ ssh_signature_free(sig);
+ return NULL;
+ }
+
+# ifdef DEBUG_CRYPTO
+ ssh_print_bignum("r", sig->ecdsa_sig->r);
+ ssh_print_bignum("s", sig->ecdsa_sig->s);
+# endif /* DEBUG_CRYPTO */
+
+ break;
+#endif /* HAVE_OPENSSL_ECC */
case SSH_KEYTYPE_UNKNOWN:
ssh_signature_free(sig);
return NULL;