summaryrefslogtreecommitdiff
path: root/key.h
diff options
context:
space:
mode:
Diffstat (limited to 'key.h')
-rw-r--r--key.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/key.h b/key.h
index 11d30eae6..ec5ac5eb8 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.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
33typedef struct Key Key; 36typedef struct Key Key;
34enum types { 37enum 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 **);
105int key_cert_is_legacy(Key *); 116int key_cert_is_legacy(Key *);
106 117
118int key_ecdsa_nid_from_name(const char *);
119int key_curve_name_to_nid(const char *);
120const char * key_curve_nid_to_name(int);
121u_int key_curve_nid_to_bits(int);
122int key_ecdsa_bits_to_nid(int);
123#ifdef OPENSSL_HAS_ECC
124int key_ecdsa_key_to_nid(EC_KEY *);
125const EVP_MD * key_ec_nid_to_evpmd(int nid);
126int key_ec_validate_public(const EC_GROUP *, const EC_POINT *);
127int key_ec_validate_private(const EC_KEY *);
128#endif
129
107Key *key_from_blob(const u_char *, u_int); 130Key *key_from_blob(const u_char *, u_int);
108int key_to_blob(const Key *, u_char **, u_int *); 131int key_to_blob(const Key *, u_char **, u_int *);
109const char *key_ssh_name(const Key *); 132const char *key_ssh_name(const Key *);
133const char *key_ssh_name_plain(const Key *);
110int key_names_valid2(const char *); 134int key_names_valid2(const char *);
111 135
112int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 136int 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
115int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 139int 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); 140int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
141int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
142int 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); 143int 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); 144int 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))
147void key_dump_ec_point(const EC_GROUP *, const EC_POINT *);
148void key_dump_ec_key(const EC_KEY *);
149#endif
150
120#endif 151#endif