summaryrefslogtreecommitdiff
path: root/key.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-08-31 22:41:14 +1000
committerDamien Miller <djm@mindrot.org>2010-08-31 22:41:14 +1000
commiteb8b60e320cdade9f4c07e2abacfb92c52e01348 (patch)
tree4e5bc25790566402e5b7ae00cefd2c57e867ef09 /key.h
parentda108ece6843f1268aa36d7c8ed0030dc53acd15 (diff)
- djm@cvs.openbsd.org 2010/08/31 11:54:45
[PROTOCOL PROTOCOL.agent PROTOCOL.certkeys auth2-jpake.c authfd.c] [authfile.c buffer.h dns.c kex.c kex.h key.c key.h monitor.c] [monitor_wrap.c myproposal.h packet.c packet.h pathnames.h readconf.c] [ssh-add.1 ssh-add.c ssh-agent.1 ssh-agent.c ssh-keygen.1 ssh-keygen.c] [ssh-keyscan.1 ssh-keyscan.c ssh-keysign.8 ssh.1 ssh.c ssh2.h] [ssh_config.5 sshconnect.c sshconnect2.c sshd.8 sshd.c sshd_config.5] [uuencode.c uuencode.h bufec.c kexecdh.c kexecdhc.c kexecdhs.c ssh-ecdsa.c] Implement Elliptic Curve Cryptography modes for key exchange (ECDH) and host/user keys (ECDSA) as specified by RFC5656. ECDH and ECDSA offer better performance than plain DH and DSA at the same equivalent symmetric key length, as well as much shorter keys. Only the mandatory sections of RFC5656 are implemented, specifically the three REQUIRED curves nistp256, nistp384 and nistp521 and only ECDH and ECDSA. Point compression (optional in RFC5656 is NOT implemented). Certificate host and user keys using the new ECDSA key types are supported. Note that this code has not been tested for interoperability and may be subject to change. feedback and ok markus@
Diffstat (limited to 'key.h')
-rw-r--r--key.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/key.h b/key.h
index 11d30eae6..2eb124364 100644
--- a/key.h
+++ b/key.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.h,v 1.30 2010/04/16 01:47:26 djm Exp $ */ 1/* $OpenBSD: key.h,v 1.31 2010/08/31 11:54:45 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -29,14 +29,17 @@
29#include "buffer.h" 29#include "buffer.h"
30#include <openssl/rsa.h> 30#include <openssl/rsa.h>
31#include <openssl/dsa.h> 31#include <openssl/dsa.h>
32#include <openssl/ec.h>
32 33
33typedef struct Key Key; 34typedef struct Key Key;
34enum types { 35enum types {
35 KEY_RSA1, 36 KEY_RSA1,
36 KEY_RSA, 37 KEY_RSA,
37 KEY_DSA, 38 KEY_DSA,
39 KEY_ECDSA,
38 KEY_RSA_CERT, 40 KEY_RSA_CERT,
39 KEY_DSA_CERT, 41 KEY_DSA_CERT,
42 KEY_ECDSA_CERT,
40 KEY_RSA_CERT_V00, 43 KEY_RSA_CERT_V00,
41 KEY_DSA_CERT_V00, 44 KEY_DSA_CERT_V00,
42 KEY_UNSPEC 45 KEY_UNSPEC
@@ -73,6 +76,8 @@ struct Key {
73 int flags; 76 int flags;
74 RSA *rsa; 77 RSA *rsa;
75 DSA *dsa; 78 DSA *dsa;
79 int ecdsa_nid; /* NID of curve */
80 EC_KEY *ecdsa;
76 struct KeyCert *cert; 81 struct KeyCert *cert;
77}; 82};
78 83
@@ -104,9 +109,18 @@ int key_cert_check_authority(const Key *, int, int, const char *,
104 const char **); 109 const char **);
105int key_cert_is_legacy(Key *); 110int key_cert_is_legacy(Key *);
106 111
112int key_ecdsa_nid_from_name(const char *);
113int key_curve_name_to_nid(const char *);
114const char * key_curve_nid_to_name(int);
115int key_ecdsa_bits_to_nid(int);
116int key_ecdsa_group_to_nid(const EC_GROUP *);
117int key_ec_validate_public(const EC_GROUP *, const EC_POINT *);
118int key_ec_validate_private(const EC_KEY *);
119
107Key *key_from_blob(const u_char *, u_int); 120Key *key_from_blob(const u_char *, u_int);
108int key_to_blob(const Key *, u_char **, u_int *); 121int key_to_blob(const Key *, u_char **, u_int *);
109const char *key_ssh_name(const Key *); 122const char *key_ssh_name(const Key *);
123const char *key_ssh_name_plain(const Key *);
110int key_names_valid2(const char *); 124int key_names_valid2(const char *);
111 125
112int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 126int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
@@ -114,7 +128,14 @@ int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
114 128
115int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 129int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
116int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); 130int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
131int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
132int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
117int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 133int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
118int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); 134int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
119 135
136#if defined(DEBUG_KEXECDH) || defined(DEBUG_PK)
137void key_dump_ec_point(const EC_GROUP *, const EC_POINT *);
138void key_dump_ec_key(const EC_KEY *);
139#endif
140
120#endif 141#endif