diff options
author | Damien Miller <djm@mindrot.org> | 2010-08-31 22:41:14 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-08-31 22:41:14 +1000 |
commit | eb8b60e320cdade9f4c07e2abacfb92c52e01348 (patch) | |
tree | 4e5bc25790566402e5b7ae00cefd2c57e867ef09 /key.h | |
parent | da108ece6843f1268aa36d7c8ed0030dc53acd15 (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.h | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -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 | ||
33 | typedef struct Key Key; | 34 | typedef struct Key Key; |
34 | enum types { | 35 | enum 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 **); |
105 | int key_cert_is_legacy(Key *); | 110 | int key_cert_is_legacy(Key *); |
106 | 111 | ||
112 | int key_ecdsa_nid_from_name(const char *); | ||
113 | int key_curve_name_to_nid(const char *); | ||
114 | const char * key_curve_nid_to_name(int); | ||
115 | int key_ecdsa_bits_to_nid(int); | ||
116 | int key_ecdsa_group_to_nid(const EC_GROUP *); | ||
117 | int key_ec_validate_public(const EC_GROUP *, const EC_POINT *); | ||
118 | int key_ec_validate_private(const EC_KEY *); | ||
119 | |||
107 | Key *key_from_blob(const u_char *, u_int); | 120 | Key *key_from_blob(const u_char *, u_int); |
108 | int key_to_blob(const Key *, u_char **, u_int *); | 121 | int key_to_blob(const Key *, u_char **, u_int *); |
109 | const char *key_ssh_name(const Key *); | 122 | const char *key_ssh_name(const Key *); |
123 | const char *key_ssh_name_plain(const Key *); | ||
110 | int key_names_valid2(const char *); | 124 | int key_names_valid2(const char *); |
111 | 125 | ||
112 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 126 | int 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 | ||
115 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 129 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
116 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | 130 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
131 | int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | ||
132 | int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | ||
117 | int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 133 | int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
118 | int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | 134 | int 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) | ||
137 | void key_dump_ec_point(const EC_GROUP *, const EC_POINT *); | ||
138 | void key_dump_ec_key(const EC_KEY *); | ||
139 | #endif | ||
140 | |||
120 | #endif | 141 | #endif |