diff options
author | markus@openbsd.org <markus@openbsd.org> | 2017-05-30 08:52:19 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-05-31 10:47:31 +1000 |
commit | 54d90ace1d3535b44d92a8611952dc109a74a031 (patch) | |
tree | 1b5ff69321b88b32fba058fe2c966bf177c95b28 /sshd.c | |
parent | c221219b1fbee47028dcaf66613f4f8d6b7640e9 (diff) |
upstream commit
switch from Key typedef with struct sshkey; ok djm@
Upstream-ID: 3067d33e04efbe5131ce8f70668c47a58e5b7a1f
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 43 |
1 files changed, 22 insertions, 21 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.487 2017/04/30 23:18:44 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.488 2017/05/30 08:52:20 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -195,10 +195,10 @@ int have_agent = 0; | |||
195 | * not very useful. Currently, memory locking is not implemented. | 195 | * not very useful. Currently, memory locking is not implemented. |
196 | */ | 196 | */ |
197 | struct { | 197 | struct { |
198 | Key **host_keys; /* all private host keys */ | 198 | struct sshkey **host_keys; /* all private host keys */ |
199 | Key **host_pubkeys; /* all public host keys */ | 199 | struct sshkey **host_pubkeys; /* all public host keys */ |
200 | Key **host_certificates; /* all public host certificates */ | 200 | struct sshkey **host_certificates; /* all public host certificates */ |
201 | int have_ssh2_key; | 201 | int have_ssh2_key; |
202 | } sensitive_data; | 202 | } sensitive_data; |
203 | 203 | ||
204 | /* This is set to true when a signal is received. */ | 204 | /* This is set to true when a signal is received. */ |
@@ -486,7 +486,7 @@ destroy_sensitive_data(void) | |||
486 | void | 486 | void |
487 | demote_sensitive_data(void) | 487 | demote_sensitive_data(void) |
488 | { | 488 | { |
489 | Key *tmp; | 489 | struct sshkey *tmp; |
490 | int i; | 490 | int i; |
491 | 491 | ||
492 | for (i = 0; i < options.num_host_key_files; i++) { | 492 | for (i = 0; i < options.num_host_key_files; i++) { |
@@ -686,7 +686,7 @@ list_hostkey_types(void) | |||
686 | const char *p; | 686 | const char *p; |
687 | char *ret; | 687 | char *ret; |
688 | int i; | 688 | int i; |
689 | Key *key; | 689 | struct sshkey *key; |
690 | 690 | ||
691 | buffer_init(&b); | 691 | buffer_init(&b); |
692 | for (i = 0; i < options.num_host_key_files; i++) { | 692 | for (i = 0; i < options.num_host_key_files; i++) { |
@@ -742,11 +742,11 @@ list_hostkey_types(void) | |||
742 | return ret; | 742 | return ret; |
743 | } | 743 | } |
744 | 744 | ||
745 | static Key * | 745 | static struct sshkey * |
746 | get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh) | 746 | get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh) |
747 | { | 747 | { |
748 | int i; | 748 | int i; |
749 | Key *key; | 749 | struct sshkey *key; |
750 | 750 | ||
751 | for (i = 0; i < options.num_host_key_files; i++) { | 751 | for (i = 0; i < options.num_host_key_files; i++) { |
752 | switch (type) { | 752 | switch (type) { |
@@ -770,19 +770,19 @@ get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh) | |||
770 | return NULL; | 770 | return NULL; |
771 | } | 771 | } |
772 | 772 | ||
773 | Key * | 773 | struct sshkey * |
774 | get_hostkey_public_by_type(int type, int nid, struct ssh *ssh) | 774 | get_hostkey_public_by_type(int type, int nid, struct ssh *ssh) |
775 | { | 775 | { |
776 | return get_hostkey_by_type(type, nid, 0, ssh); | 776 | return get_hostkey_by_type(type, nid, 0, ssh); |
777 | } | 777 | } |
778 | 778 | ||
779 | Key * | 779 | struct sshkey * |
780 | get_hostkey_private_by_type(int type, int nid, struct ssh *ssh) | 780 | get_hostkey_private_by_type(int type, int nid, struct ssh *ssh) |
781 | { | 781 | { |
782 | return get_hostkey_by_type(type, nid, 1, ssh); | 782 | return get_hostkey_by_type(type, nid, 1, ssh); |
783 | } | 783 | } |
784 | 784 | ||
785 | Key * | 785 | struct sshkey * |
786 | get_hostkey_by_index(int ind) | 786 | get_hostkey_by_index(int ind) |
787 | { | 787 | { |
788 | if (ind < 0 || ind >= options.num_host_key_files) | 788 | if (ind < 0 || ind >= options.num_host_key_files) |
@@ -790,7 +790,7 @@ get_hostkey_by_index(int ind) | |||
790 | return (sensitive_data.host_keys[ind]); | 790 | return (sensitive_data.host_keys[ind]); |
791 | } | 791 | } |
792 | 792 | ||
793 | Key * | 793 | struct sshkey * |
794 | get_hostkey_public_by_index(int ind, struct ssh *ssh) | 794 | get_hostkey_public_by_index(int ind, struct ssh *ssh) |
795 | { | 795 | { |
796 | if (ind < 0 || ind >= options.num_host_key_files) | 796 | if (ind < 0 || ind >= options.num_host_key_files) |
@@ -799,7 +799,7 @@ get_hostkey_public_by_index(int ind, struct ssh *ssh) | |||
799 | } | 799 | } |
800 | 800 | ||
801 | int | 801 | int |
802 | get_hostkey_index(Key *key, int compare, struct ssh *ssh) | 802 | get_hostkey_index(struct sshkey *key, int compare, struct ssh *ssh) |
803 | { | 803 | { |
804 | int i; | 804 | int i; |
805 | 805 | ||
@@ -1366,8 +1366,8 @@ main(int ac, char **av) | |||
1366 | u_int n; | 1366 | u_int n; |
1367 | u_int64_t ibytes, obytes; | 1367 | u_int64_t ibytes, obytes; |
1368 | mode_t new_umask; | 1368 | mode_t new_umask; |
1369 | Key *key; | 1369 | struct sshkey *key; |
1370 | Key *pubkey; | 1370 | struct sshkey *pubkey; |
1371 | int keytype; | 1371 | int keytype; |
1372 | Authctxt *authctxt; | 1372 | Authctxt *authctxt; |
1373 | struct connection_info *connection_info = get_connection_info(0, 0); | 1373 | struct connection_info *connection_info = get_connection_info(0, 0); |
@@ -1655,9 +1655,9 @@ main(int ac, char **av) | |||
1655 | 1655 | ||
1656 | /* load host keys */ | 1656 | /* load host keys */ |
1657 | sensitive_data.host_keys = xcalloc(options.num_host_key_files, | 1657 | sensitive_data.host_keys = xcalloc(options.num_host_key_files, |
1658 | sizeof(Key *)); | 1658 | sizeof(struct sshkey *)); |
1659 | sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, | 1659 | sensitive_data.host_pubkeys = xcalloc(options.num_host_key_files, |
1660 | sizeof(Key *)); | 1660 | sizeof(struct sshkey *)); |
1661 | 1661 | ||
1662 | if (options.host_key_agent) { | 1662 | if (options.host_key_agent) { |
1663 | if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) | 1663 | if (strcmp(options.host_key_agent, SSH_AUTHSOCKET_ENV_NAME)) |
@@ -1721,7 +1721,7 @@ main(int ac, char **av) | |||
1721 | * indices to the public keys that they relate to. | 1721 | * indices to the public keys that they relate to. |
1722 | */ | 1722 | */ |
1723 | sensitive_data.host_certificates = xcalloc(options.num_host_key_files, | 1723 | sensitive_data.host_certificates = xcalloc(options.num_host_key_files, |
1724 | sizeof(Key *)); | 1724 | sizeof(struct sshkey *)); |
1725 | for (i = 0; i < options.num_host_key_files; i++) | 1725 | for (i = 0; i < options.num_host_key_files; i++) |
1726 | sensitive_data.host_certificates[i] = NULL; | 1726 | sensitive_data.host_certificates[i] = NULL; |
1727 | 1727 | ||
@@ -2109,8 +2109,9 @@ main(int ac, char **av) | |||
2109 | } | 2109 | } |
2110 | 2110 | ||
2111 | int | 2111 | int |
2112 | sshd_hostkey_sign(Key *privkey, Key *pubkey, u_char **signature, size_t *slen, | 2112 | sshd_hostkey_sign(struct sshkey *privkey, struct sshkey *pubkey, |
2113 | const u_char *data, size_t dlen, const char *alg, u_int flag) | 2113 | u_char **signature, size_t *slen, const u_char *data, size_t dlen, |
2114 | const char *alg, u_int flag) | ||
2114 | { | 2115 | { |
2115 | int r; | 2116 | int r; |
2116 | u_int xxx_slen, xxx_dlen = dlen; | 2117 | u_int xxx_slen, xxx_dlen = dlen; |