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_NULL, | 47 | KEY_NULL, |
@@ -74,6 +79,12 @@ struct Key { | |||
74 | int flags; | 79 | int flags; |
75 | RSA *rsa; | 80 | RSA *rsa; |
76 | DSA *dsa; | 81 | DSA *dsa; |
82 | int ecdsa_nid; /* NID of curve */ | ||
83 | #ifdef OPENSSL_HAS_ECC | ||
84 | EC_KEY *ecdsa; | ||
85 | #else | ||
86 | void *ecdsa; | ||
87 | #endif | ||
77 | struct KeyCert *cert; | 88 | struct KeyCert *cert; |
78 | }; | 89 | }; |
79 | 90 | ||
@@ -105,9 +116,22 @@ int key_cert_check_authority(const Key *, int, int, const char *, | |||
105 | const char **); | 116 | const char **); |
106 | int key_cert_is_legacy(Key *); | 117 | int key_cert_is_legacy(Key *); |
107 | 118 | ||
119 | int key_ecdsa_nid_from_name(const char *); | ||
120 | int key_curve_name_to_nid(const char *); | ||
121 | const char * key_curve_nid_to_name(int); | ||
122 | u_int key_curve_nid_to_bits(int); | ||
123 | int key_ecdsa_bits_to_nid(int); | ||
124 | #ifdef OPENSSL_HAS_ECC | ||
125 | int key_ecdsa_key_to_nid(EC_KEY *); | ||
126 | const EVP_MD * key_ec_nid_to_evpmd(int nid); | ||
127 | int key_ec_validate_public(const EC_GROUP *, const EC_POINT *); | ||
128 | int key_ec_validate_private(const EC_KEY *); | ||
129 | #endif | ||
130 | |||
108 | Key *key_from_blob(const u_char *, u_int); | 131 | Key *key_from_blob(const u_char *, u_int); |
109 | int key_to_blob(const Key *, u_char **, u_int *); | 132 | int key_to_blob(const Key *, u_char **, u_int *); |
110 | const char *key_ssh_name(const Key *); | 133 | const char *key_ssh_name(const Key *); |
134 | const char *key_ssh_name_plain(const Key *); | ||
111 | int key_names_valid2(const char *); | 135 | int key_names_valid2(const char *); |
112 | 136 | ||
113 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 137 | int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
@@ -115,7 +139,14 @@ int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | |||
115 | 139 | ||
116 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 140 | int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
117 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | 141 | int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
142 | int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | ||
143 | int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | ||
118 | int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); | 144 | int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); |
119 | int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); | 145 | int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); |
120 | 146 | ||
147 | #if defined(OPENSSL_HAS_ECC) && (defined(DEBUG_KEXECDH) || defined(DEBUG_PK)) | ||
148 | void key_dump_ec_point(const EC_GROUP *, const EC_POINT *); | ||
149 | void key_dump_ec_key(const EC_KEY *); | ||
150 | #endif | ||
151 | |||
121 | #endif | 152 | #endif |