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 810f2aaae..8b5c5659c 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_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 **);
106int key_cert_is_legacy(Key *); 117int key_cert_is_legacy(Key *);
107 118
119int key_ecdsa_nid_from_name(const char *);
120int key_curve_name_to_nid(const char *);
121const char * key_curve_nid_to_name(int);
122u_int key_curve_nid_to_bits(int);
123int key_ecdsa_bits_to_nid(int);
124#ifdef OPENSSL_HAS_ECC
125int key_ecdsa_key_to_nid(EC_KEY *);
126const EVP_MD * key_ec_nid_to_evpmd(int nid);
127int key_ec_validate_public(const EC_GROUP *, const EC_POINT *);
128int key_ec_validate_private(const EC_KEY *);
129#endif
130
108Key *key_from_blob(const u_char *, u_int); 131Key *key_from_blob(const u_char *, u_int);
109int key_to_blob(const Key *, u_char **, u_int *); 132int key_to_blob(const Key *, u_char **, u_int *);
110const char *key_ssh_name(const Key *); 133const char *key_ssh_name(const Key *);
134const char *key_ssh_name_plain(const Key *);
111int key_names_valid2(const char *); 135int key_names_valid2(const char *);
112 136
113int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 137int 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
116int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 140int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
117int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int); 141int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
142int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
143int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
118int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int); 144int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
119int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int); 145int 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))
148void key_dump_ec_point(const EC_GROUP *, const EC_POINT *);
149void key_dump_ec_key(const EC_KEY *);
150#endif
151
121#endif 152#endif