diff options
Diffstat (limited to 'key.h')
-rw-r--r-- | key.h | 33 |
1 files changed, 32 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.33 2010/10/28 11:22:09 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,19 @@ | |||
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 | #ifdef OPENSSL_HAS_ECC | ||
33 | #include <openssl/ec.h> | ||
34 | #endif | ||
32 | 35 | ||
33 | typedef struct Key Key; | 36 | typedef struct Key Key; |
34 | enum types { | 37 | enum types { |
35 | KEY_RSA1, | 38 | KEY_RSA1, |
36 | KEY_RSA, | 39 | KEY_RSA, |
37 | KEY_DSA, | 40 | KEY_DSA, |
41 | KEY_ECDSA, | ||
38 | KEY_RSA_CERT, | 42 | KEY_RSA_CERT, |
39 | KEY_DSA_CERT, | 43 | KEY_DSA_CERT, |
44 | KEY_ECDSA_CERT, | ||
40 | KEY_RSA_CERT_V00, | 45 | KEY_RSA_CERT_V00, |
41 | KEY_DSA_CERT_V00, | 46 | KEY_DSA_CERT_V00, |
42 | KEY_UNSPEC | 47 | KEY_UNSPEC |
@@ -73,6 +78,12 @@ struct Key { | |||
73 | int flags; | 78 | int flags; |
74 | RSA *rsa; | 79 | RSA *rsa; |
75 | DSA *dsa; | 80 | DSA *dsa; |
81 | int ecdsa_nid; /* NID of curve */ | ||
82 | #ifdef OPENSSL_HAS_ECC | ||
83 | EC_KEY *ecdsa; | ||
84 | #else | ||
85 | void *ecdsa; | ||
86 | #endif | ||
76 | struct KeyCert *cert; | 87 | struct KeyCert *cert; |
77 | }; | 88 | }; |
78 | 89 | ||
@@ -104,9 +115,22 @@ int key_cert_check_authority(const Key *, int, int, const char *, | |||
104 | const char **); | 115 | const char **); |
105 | int key_cert_is_legacy(Key *); | 116 | int key_cert_is_legacy(Key *); |
106 | 117 | ||
118 | int key_ecdsa_nid_from_name(const char *); | ||
119 | int key_curve_name_to_nid(const char *); | ||
120 | const char * key_curve_nid_to_name(int); | ||
121 | u_int key_curve_nid_to_bits(int); | ||
122 | int key_ecdsa_bits_to_nid(int); | ||
123 | #ifdef OPENSSL_HAS_ECC | ||
124 | int key_ecdsa_key_to_nid(EC_KEY *); | ||
125 | const EVP_MD * key_ec_nid_to_evpmd(int nid); | ||
126 | int key_ec_validate_public(const EC_GROUP *, const EC_POINT *); | ||
127 | int key_ec_validate_private(const EC_KEY *); | ||
128 | #endif | ||
129 | |||
107 | Key *key_from_blob(const u_char *, u_int); | 130 | Key *key_from_blob(const u_char *, u_int); |
108 | int key_to_blob(const Key *, u_char **, u_int *); | 131 | int key_to_blob(const Key *, u_char **, u_int *); |
109 | const char *key_ssh_name(const Key *); | 132 | const char *key_ssh_name(const Key *); |
133 | const char *key_ssh_name_plain(const Key *); | ||
110 | int key_names_valid2(const char *); | 134 | int key_names_valid2(const char *); |
111 | 135 | ||
112 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 136 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
@@ -114,7 +138,14 @@ int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | |||
114 | 138 | ||
115 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 139 | 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); | 140 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
141 | int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | ||
142 | 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); | 143 | 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); | 144 | int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
119 | 145 | ||
146 | #if defined(OPENSSL_HAS_ECC) && (defined(DEBUG_KEXECDH) || defined(DEBUG_PK)) | ||
147 | void key_dump_ec_point(const EC_GROUP *, const EC_POINT *); | ||
148 | void key_dump_ec_key(const EC_KEY *); | ||
149 | #endif | ||
150 | |||
120 | #endif | 151 | #endif |