| atomicio.h | | atomicio.h | |
|
| | | /* $OpenBSD: atomicio.h,v 1.11 2010/09/22 22:58:51 djm Exp $ */ | |
| | | | |
| /* | | /* | |
|
| | | * Copyright (c) 2006 Damien Miller. All rights reserved. | |
| * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. | | * Copyright (c) 1995,1999 Theo de Raadt. All rights reserved. | |
| * All rights reserved. | | * All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions | | * modification, are permitted provided that the following conditions | |
| * are met: | | * are met: | |
| * 1. Redistributions of source code must retain the above copyright | | * 1. Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * 2. Redistributions in binary form must reproduce the above copyright | | * 2. Redistributions in binary form must reproduce the above copyright | |
| * notice, this list of conditions and the following disclaimer in the | | * notice, this list of conditions and the following disclaimer in the | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 29 | |
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| | | | |
|
| | | #ifndef _ATOMICIO_H | |
| | | #define _ATOMICIO_H | |
| | | | |
| /* | | /* | |
| * Ensure all of data on socket comes through. f==read || f==vwrite | | * Ensure all of data on socket comes through. f==read || f==vwrite | |
| */ | | */ | |
|
| ssize_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size | | size_t | |
| _t); | | atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n, | |
| | | int (*cb)(void *, size_t), void *); | |
| | | size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t); | |
| | | | |
| #define vwrite (ssize_t (*)(int, void *, size_t))write | | #define vwrite (ssize_t (*)(int, void *, size_t))write | |
|
| | | | |
| | | /* | |
| | | * ensure all of data on socket comes through. f==readv || f==writev | |
| | | */ | |
| | | size_t | |
| | | atomiciov6(ssize_t (*f) (int, const struct iovec *, int), int fd, | |
| | | const struct iovec *_iov, int iovcnt, int (*cb)(void *, size_t), void * | |
| | | ); | |
| | | size_t atomiciov(ssize_t (*)(int, const struct iovec *, int), | |
| | | int, const struct iovec *, int); | |
| | | | |
| | | #endif /* _ATOMICIO_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 2 lines changed or deleted | | 10 lines changed or added | |
|
| authfd.h | | authfd.h | |
|
| | | /* $OpenBSD: authfd.h,v 1.37 2009/08/27 17:44:52 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * Functions to interface with the SSH_AUTHENTICATION_FD socket. | | * Functions to interface with the SSH_AUTHENTICATION_FD socket. | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| * called by a name other than "ssh" or "Secure Shell". | | * called by a name other than "ssh" or "Secure Shell". | |
| */ | | */ | |
| | | | |
| #ifndef AUTHFD_H | | #ifndef AUTHFD_H | |
| #define AUTHFD_H | | #define AUTHFD_H | |
| | | | |
|
| #include "buffer.h" | | | |
| | | | |
| /* Messages for the authentication agent connection. */ | | /* Messages for the authentication agent connection. */ | |
| #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 | | #define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1 | |
| #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 | | #define SSH_AGENT_RSA_IDENTITIES_ANSWER 2 | |
| #define SSH_AGENTC_RSA_CHALLENGE 3 | | #define SSH_AGENTC_RSA_CHALLENGE 3 | |
| #define SSH_AGENT_RSA_RESPONSE 4 | | #define SSH_AGENT_RSA_RESPONSE 4 | |
| #define SSH_AGENT_FAILURE 5 | | #define SSH_AGENT_FAILURE 5 | |
| #define SSH_AGENT_SUCCESS 6 | | #define SSH_AGENT_SUCCESS 6 | |
| #define SSH_AGENTC_ADD_RSA_IDENTITY 7 | | #define SSH_AGENTC_ADD_RSA_IDENTITY 7 | |
| #define SSH_AGENTC_REMOVE_RSA_IDENTITY 8 | | #define SSH_AGENTC_REMOVE_RSA_IDENTITY 8 | |
| #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9 | | #define SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9 | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 69 | |
| #define SSH_COM_AGENT2_FAILURE 102 | | #define SSH_COM_AGENT2_FAILURE 102 | |
| | | | |
| #define SSH_AGENT_OLD_SIGNATURE 0x01 | | #define SSH_AGENT_OLD_SIGNATURE 0x01 | |
| | | | |
| typedef struct { | | typedef struct { | |
| int fd; | | int fd; | |
| Buffer identities; | | Buffer identities; | |
| int howmany; | | int howmany; | |
| } AuthenticationConnection; | | } AuthenticationConnection; | |
| | | | |
|
| int ssh_get_authentication_socket(const char *); | | ////int ssh_agent_present(void); | |
| | | int ssh_get_authentication_socket_authsocket(const char *authsocket); | |
| void ssh_close_authentication_socket(int); | | void ssh_close_authentication_socket(int); | |
| | | | |
|
| AuthenticationConnection *ssh_get_authentication_connection(const char *); | | AuthenticationConnection *ssh_get_authentication_connection_authsocket(cons
t char *authsocket); | |
| void ssh_close_authentication_connection(AuthenticationConnection *); | | void ssh_close_authentication_connection(AuthenticationConnection *); | |
|
| int ssh_add_identity(AuthenticationConnection *, Key *, const char *); | | ////int ssh_get_num_identities(AuthenticationConnection *, int); | |
| | | ////Key *ssh_get_first_identity(AuthenticationConnection *, char **, | |
| | | int); | |
| | | ////Key *ssh_get_next_identity(AuthenticationConnection *, char **, | |
| | | int); | |
| | | int ssh_add_identity_constrained(AuthenticationConnection *, Key *, | |
| | | const char *, u_int, u_int); | |
| | | ////int ssh_remove_identity(AuthenticationConnection *, Key *); | |
| | | ////int ssh_remove_all_identities(AuthenticationConnection *, int); | |
| | | ////int ssh_lock_agent(AuthenticationConnection *, int, const char | |
| | | *); | |
| | | ////int ssh_update_card(AuthenticationConnection *, int, const char | |
| | | *, | |
| | | //// const char *, u_int, u_int); | |
| | | | |
| | | ////int | |
| | | ////ssh_decrypt_challenge(AuthenticationConnection *, Key *, BIGNUM *, u_ch | |
| | | ar[16], | |
| | | //// u_int, u_char[16]); | |
| | | | |
| | | ////int | |
| | | ////ssh_agent_sign(AuthenticationConnection *, Key *, u_char **, u_int *, u | |
| | | _char *, | |
| | | //// u_int); | |
| | | | |
| #endif /* AUTHFD_H */ | | #endif /* AUTHFD_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 29 lines changed or added | |
|
| authfile.h | | authfile.h | |
|
| | | /* $OpenBSD: authfile.h,v 1.16 2011/05/04 21:15:29 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| * called by a name other than "ssh" or "Secure Shell". | | * called by a name other than "ssh" or "Secure Shell". | |
| */ | | */ | |
| | | | |
| #ifndef AUTHFILE_H | | #ifndef AUTHFILE_H | |
| #define AUTHFILE_H | | #define AUTHFILE_H | |
| | | | |
|
| | | ////int key_save_private(Key *, const char *, const char *, const c | |
| | | har *); | |
| | | int key_load_file(int, const char *, Buffer *); | |
| | | ////Key *key_load_cert(const char *); | |
| | | ////Key *key_load_public(const char *, char **); | |
| Key *key_load_public_type(int, const char *, char **); | | Key *key_load_public_type(int, const char *, char **); | |
|
| | | ////Key *key_parse_private(Buffer *, const char *, const char *, cha
r **); | |
| Key *key_load_private(const char *, const char *, char **); | | Key *key_load_private(const char *, const char *, char **); | |
|
| Key *key_load_private_type(int, const char *, const char *, char **); | | ////Key *key_load_private_cert(int, const char *, const char *, int | |
| | | *); | |
| | | Key *key_load_private_type(int, const char *, const char *, char **, int | |
| | | *); | |
| | | ////Key *key_load_private_pem(int, int, const char *, char **); | |
| | | int key_perm_ok(int, const char *); | |
| | | ////int key_in_file(Key *, const char *, int); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 4 change blocks. |
| 1 lines changed or deleted | | 15 lines changed or added | |
|
| buffer.h | | buffer.h | |
|
| | | /* $OpenBSD: buffer.h,v 1.21 2010/08/31 11:54:45 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * Code for manipulating FIFO buffers. | | * Code for manipulating FIFO buffers. | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 30 | |
| u_char *buf; /* Buffer for data. */ | | u_char *buf; /* Buffer for data. */ | |
| u_int alloc; /* Number of bytes allocated for data. */ | | u_int alloc; /* Number of bytes allocated for data. */ | |
| u_int offset; /* Offset of first byte containing data. */ | | u_int offset; /* Offset of first byte containing data. */ | |
| u_int end; /* Offset of last byte containing data. */ | | u_int end; /* Offset of last byte containing data. */ | |
| } Buffer; | | } Buffer; | |
| | | | |
| void buffer_init(Buffer *); | | void buffer_init(Buffer *); | |
| void buffer_clear(Buffer *); | | void buffer_clear(Buffer *); | |
| void buffer_free(Buffer *); | | void buffer_free(Buffer *); | |
| | | | |
|
| u_int buffer_len(Buffer *); | | u_int buffer_len(const Buffer *); | |
| void *buffer_ptr(Buffer *); | | void *buffer_ptr(const Buffer *); | |
| | | | |
| void buffer_append(Buffer *, const void *, u_int); | | void buffer_append(Buffer *, const void *, u_int); | |
| void *buffer_append_space(Buffer *, u_int); | | void *buffer_append_space(Buffer *, u_int); | |
| | | | |
|
| | | int buffer_check_alloc(Buffer *, u_int); | |
| | | | |
| void buffer_get(Buffer *, void *, u_int); | | void buffer_get(Buffer *, void *, u_int); | |
| | | | |
| void buffer_consume(Buffer *, u_int); | | void buffer_consume(Buffer *, u_int); | |
| void buffer_consume_end(Buffer *, u_int); | | void buffer_consume_end(Buffer *, u_int); | |
| | | | |
|
| void buffer_dump(Buffer *); | | void buffer_dump(const Buffer *); | |
| | | | |
| | | int buffer_get_ret(Buffer *, void *, u_int); | |
| | | int buffer_consume_ret(Buffer *, u_int); | |
| | | int buffer_consume_end_ret(Buffer *, u_int); | |
| | | | |
| | | #include <openssl/bn.h> | |
| | | | |
| | | void buffer_put_bignum(Buffer *, const BIGNUM *); | |
| | | void buffer_put_bignum2(Buffer *, const BIGNUM *); | |
| | | void buffer_get_bignum(Buffer *, BIGNUM *); | |
| | | void buffer_get_bignum2(Buffer *, BIGNUM *); | |
| | | | |
| | | u_short buffer_get_short(Buffer *); | |
| | | void buffer_put_short(Buffer *, u_short); | |
| | | | |
| | | u_int buffer_get_int(Buffer *); | |
| | | void buffer_put_int(Buffer *, u_int); | |
| | | | |
| | | u_int64_t buffer_get_int64(Buffer *); | |
| | | void buffer_put_int64(Buffer *, u_int64_t); | |
| | | | |
| | | int buffer_get_char(Buffer *); | |
| | | void buffer_put_char(Buffer *, int); | |
| | | | |
| | | void *buffer_get_string(Buffer *, u_int *); | |
| | | void *buffer_get_string_ptr(Buffer *, u_int *); | |
| | | void buffer_put_string(Buffer *, const void *, u_int); | |
| | | char *buffer_get_cstring(Buffer *, u_int *); | |
| | | void buffer_put_cstring(Buffer *, const char *); | |
| | | | |
| | | #define buffer_skip_string(b) \ | |
| | | do { u_int l = buffer_get_int(b); buffer_consume(b, l); } while (0) | |
| | | | |
| | | int buffer_put_bignum_ret(Buffer *, const BIGNUM *); | |
| | | int buffer_get_bignum_ret(Buffer *, BIGNUM *); | |
| | | int buffer_put_bignum2_ret(Buffer *, const BIGNUM *); | |
| | | int buffer_get_bignum2_ret(Buffer *, BIGNUM *); | |
| | | int buffer_get_short_ret(u_short *, Buffer *); | |
| | | int buffer_get_int_ret(u_int *, Buffer *); | |
| | | int buffer_get_int64_ret(u_int64_t *, Buffer *); | |
| | | void *buffer_get_string_ret(Buffer *, u_int *); | |
| | | char *buffer_get_cstring_ret(Buffer *, u_int *); | |
| | | void *buffer_get_string_ptr_ret(Buffer *, u_int *); | |
| | | int buffer_get_char_ret(char *, Buffer *); | |
| | | | |
| | | #ifdef OPENSSL_HAS_ECC | |
| | | #include <openssl/ec.h> | |
| | | | |
| | | int buffer_put_ecpoint_ret(Buffer *, const EC_GROUP *, const EC_POINT *) | |
| | | ; | |
| | | void buffer_put_ecpoint(Buffer *, const EC_GROUP *, const EC_POINT *); | |
| | | int buffer_get_ecpoint_ret(Buffer *, const EC_GROUP *, EC_POINT *); | |
| | | void buffer_get_ecpoint(Buffer *, const EC_GROUP *, EC_POINT *); | |
| | | #endif | |
| | | | |
| #endif /* BUFFER_H */ | | #endif /* BUFFER_H */ | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 61 lines changed or added | |
|
| cipher.h | | cipher.h | |
|
| | | /* $OpenBSD: cipher.h,v 1.37 2009/01/26 09:58:15 markus Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| * called by a name other than "ssh" or "Secure Shell". | | * called by a name other than "ssh" or "Secure Shell". | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 46 | |
| | | | |
| #ifndef CIPHER_H | | #ifndef CIPHER_H | |
| #define CIPHER_H | | #define CIPHER_H | |
| | | | |
| #include <openssl/evp.h> | | #include <openssl/evp.h> | |
| /* | | /* | |
| * Cipher types for SSH-1. New types can be added, but old types should no
t | | * Cipher types for SSH-1. New types can be added, but old types should no
t | |
| * be removed for compatibility. The maximum allowed value is 31. | | * be removed for compatibility. The maximum allowed value is 31. | |
| */ | | */ | |
| #define SSH_CIPHER_SSH2 -3 | | #define SSH_CIPHER_SSH2 -3 | |
|
| #define SSH_CIPHER_ILLEGAL -2 /* No valid cipher selected. */ | | #define SSH_CIPHER_INVALID -2 /* No valid cipher selected. */ | |
| #define SSH_CIPHER_NOT_SET -1 /* None selected (invalid number). *
/ | | #define SSH_CIPHER_NOT_SET -1 /* None selected (invalid number). *
/ | |
| #define SSH_CIPHER_NONE 0 /* no encryption */ | | #define SSH_CIPHER_NONE 0 /* no encryption */ | |
| #define SSH_CIPHER_IDEA 1 /* IDEA CFB */ | | #define SSH_CIPHER_IDEA 1 /* IDEA CFB */ | |
| #define SSH_CIPHER_DES 2 /* DES CBC */ | | #define SSH_CIPHER_DES 2 /* DES CBC */ | |
| #define SSH_CIPHER_3DES 3 /* 3DES CBC */ | | #define SSH_CIPHER_3DES 3 /* 3DES CBC */ | |
| #define SSH_CIPHER_BROKEN_TSS 4 /* TRI's Simple Stream encryption CB
C */ | | #define SSH_CIPHER_BROKEN_TSS 4 /* TRI's Simple Stream encryption CB
C */ | |
| #define SSH_CIPHER_BROKEN_RC4 5 /* Alleged RC4 */ | | #define SSH_CIPHER_BROKEN_RC4 5 /* Alleged RC4 */ | |
| #define SSH_CIPHER_BLOWFISH 6 | | #define SSH_CIPHER_BLOWFISH 6 | |
| #define SSH_CIPHER_RESERVED 7 | | #define SSH_CIPHER_RESERVED 7 | |
| #define SSH_CIPHER_MAX 31 | | #define SSH_CIPHER_MAX 31 | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 82 | |
| Cipher *cipher_by_name(const char *); | | Cipher *cipher_by_name(const char *); | |
| Cipher *cipher_by_number(int); | | Cipher *cipher_by_number(int); | |
| int cipher_number(const char *); | | int cipher_number(const char *); | |
| char *cipher_name(int); | | char *cipher_name(int); | |
| int ciphers_valid(const char *); | | int ciphers_valid(const char *); | |
| void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, | | void cipher_init(CipherContext *, Cipher *, const u_char *, u_int, | |
| const u_char *, u_int, int); | | const u_char *, u_int, int); | |
| void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); | | void cipher_crypt(CipherContext *, u_char *, const u_char *, u_int); | |
| void cipher_cleanup(CipherContext *); | | void cipher_cleanup(CipherContext *); | |
| void cipher_set_key_string(CipherContext *, Cipher *, const char *, int)
; | | void cipher_set_key_string(CipherContext *, Cipher *, const char *, int)
; | |
|
| u_int cipher_blocksize(Cipher *); | | u_int cipher_blocksize(const Cipher *); | |
| u_int cipher_keylen(Cipher *); | | u_int cipher_keylen(const Cipher *); | |
| | | u_int cipher_is_cbc(const Cipher *); | |
| | | | |
|
| u_int cipher_get_number(Cipher *); | | u_int cipher_get_number(const Cipher *); | |
| void cipher_get_keyiv(CipherContext *, u_char *, u_int); | | void cipher_get_keyiv(CipherContext *, u_char *, u_int); | |
| void cipher_set_keyiv(CipherContext *, u_char *); | | void cipher_set_keyiv(CipherContext *, u_char *); | |
|
| int cipher_get_keyiv_len(CipherContext *); | | int cipher_get_keyiv_len(const CipherContext *); | |
| int cipher_get_keycontext(CipherContext *, u_char *); | | int cipher_get_keycontext(const CipherContext *, u_char *); | |
| void cipher_set_keycontext(CipherContext *, u_char *); | | void cipher_set_keycontext(CipherContext *, u_char *); | |
| #endif /* CIPHER_H */ | | #endif /* CIPHER_H */ | |
| | | | |
End of changes. 5 change blocks. |
| 6 lines changed or deleted | | 9 lines changed or added | |
|
| config.h | | config.h | |
| | | | |
| skipping to change at line 18 | | skipping to change at line 18 | |
| /* Define to 1 if you have the declaration of `openpam_restore_cred', and t
o 0 | | /* Define to 1 if you have the declaration of `openpam_restore_cred', and t
o 0 | |
| if you don't. */ | | if you don't. */ | |
| #define HAVE_DECL_OPENPAM_RESTORE_CRED 0 | | #define HAVE_DECL_OPENPAM_RESTORE_CRED 0 | |
| | | | |
| /* Define to 1 if you have the <dlfcn.h> header file. */ | | /* Define to 1 if you have the <dlfcn.h> header file. */ | |
| #define HAVE_DLFCN_H 1 | | #define HAVE_DLFCN_H 1 | |
| | | | |
| /* Define to 1 if you have the <inttypes.h> header file. */ | | /* Define to 1 if you have the <inttypes.h> header file. */ | |
| #define HAVE_INTTYPES_H 1 | | #define HAVE_INTTYPES_H 1 | |
| | | | |
|
| | | /* Define if system has libiaf that supports set_id */ | |
| | | /* #undef HAVE_LIBIAF */ | |
| | | | |
| /* Define to 1 if you have the `memmove' function. */ | | /* Define to 1 if you have the `memmove' function. */ | |
| #define HAVE_MEMMOVE 1 | | #define HAVE_MEMMOVE 1 | |
| | | | |
| /* Define to 1 if you have the <memory.h> header file. */ | | /* Define to 1 if you have the <memory.h> header file. */ | |
| #define HAVE_MEMORY_H 1 | | #define HAVE_MEMORY_H 1 | |
| | | | |
| /* Define to 1 if you have the `memset' function. */ | | /* Define to 1 if you have the `memset' function. */ | |
| #define HAVE_MEMSET 1 | | #define HAVE_MEMSET 1 | |
| | | | |
| /* Define if we have OpenPAM */ | | /* Define if we have OpenPAM */ | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 60 | |
| | | | |
| /* Define if we have pam_std_option() */ | | /* Define if we have pam_std_option() */ | |
| /* #undef HAVE_PAM_STD_OPTION */ | | /* #undef HAVE_PAM_STD_OPTION */ | |
| | | | |
| /* Define if PAM uses struct options */ | | /* Define if PAM uses struct options */ | |
| /* #undef HAVE_PAM_STRUCT_OPTIONS */ | | /* #undef HAVE_PAM_STRUCT_OPTIONS */ | |
| | | | |
| /* Define if PAM uses struct opttab */ | | /* Define if PAM uses struct opttab */ | |
| /* #undef HAVE_PAM_STRUCT_OPTTAB */ | | /* #undef HAVE_PAM_STRUCT_OPTTAB */ | |
| | | | |
|
| | | /* Define to 1 if you have the <poll.h> header file. */ | |
| | | #define HAVE_POLL_H 1 | |
| | | | |
| | | /* Define to 1 if you have the `set_id' function. */ | |
| | | /* #undef HAVE_SET_ID */ | |
| | | | |
| /* Define to 1 if you have the <stdint.h> header file. */ | | /* Define to 1 if you have the <stdint.h> header file. */ | |
| #define HAVE_STDINT_H 1 | | #define HAVE_STDINT_H 1 | |
| | | | |
| /* Define to 1 if you have the <stdlib.h> header file. */ | | /* Define to 1 if you have the <stdlib.h> header file. */ | |
| #define HAVE_STDLIB_H 1 | | #define HAVE_STDLIB_H 1 | |
| | | | |
| /* Define to 1 if you have the <strings.h> header file. */ | | /* Define to 1 if you have the <strings.h> header file. */ | |
| #define HAVE_STRINGS_H 1 | | #define HAVE_STRINGS_H 1 | |
| | | | |
| /* Define to 1 if you have the <string.h> header file. */ | | /* Define to 1 if you have the <string.h> header file. */ | |
| #define HAVE_STRING_H 1 | | #define HAVE_STRING_H 1 | |
| | | | |
| /* Define to 1 if you have the `strlcpy' function. */ | | /* Define to 1 if you have the `strlcpy' function. */ | |
| /* #undef HAVE_STRLCPY */ | | /* #undef HAVE_STRLCPY */ | |
| | | | |
| /* Define to 1 if you have the `strnvis' function. */ | | /* Define to 1 if you have the `strnvis' function. */ | |
| /* #undef HAVE_STRNVIS */ | | /* #undef HAVE_STRNVIS */ | |
| | | | |
|
| | | /* Define to 1 if you have the <sys/poll.h> header file. */ | |
| | | #define HAVE_SYS_POLL_H 1 | |
| | | | |
| /* Define to 1 if you have the <sys/stat.h> header file. */ | | /* Define to 1 if you have the <sys/stat.h> header file. */ | |
| #define HAVE_SYS_STAT_H 1 | | #define HAVE_SYS_STAT_H 1 | |
| | | | |
| /* Define to 1 if you have the <sys/types.h> header file. */ | | /* Define to 1 if you have the <sys/types.h> header file. */ | |
| #define HAVE_SYS_TYPES_H 1 | | #define HAVE_SYS_TYPES_H 1 | |
| | | | |
| /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ | | /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ | |
| #define HAVE_SYS_WAIT_H 1 | | #define HAVE_SYS_WAIT_H 1 | |
| | | | |
| /* Define to 1 if you have the <unistd.h> header file. */ | | /* Define to 1 if you have the <unistd.h> header file. */ | |
| #define HAVE_UNISTD_H 1 | | #define HAVE_UNISTD_H 1 | |
| | | | |
| /* Define to the sub-directory in which libtool stores uninstalled librarie
s. | | /* Define to the sub-directory in which libtool stores uninstalled librarie
s. | |
| */ | | */ | |
| #define LT_OBJDIR ".libs/" | | #define LT_OBJDIR ".libs/" | |
| | | | |
|
| | | /* libcrypto includes complete ECC support */ | |
| | | #define OPENSSL_HAS_ECC 1 | |
| | | | |
| /* Name of package */ | | /* Name of package */ | |
| #define PACKAGE "pam_ssh" | | #define PACKAGE "pam_ssh" | |
| | | | |
| /* Define to the address where bug reports for this package should be sent.
*/ | | /* Define to the address where bug reports for this package should be sent.
*/ | |
| #define PACKAGE_BUGREPORT "ajk@ajk.name" | | #define PACKAGE_BUGREPORT "ajk@ajk.name" | |
| | | | |
| /* Define to the full name of this package. */ | | /* Define to the full name of this package. */ | |
| #define PACKAGE_NAME "pam_ssh" | | #define PACKAGE_NAME "pam_ssh" | |
| | | | |
| /* Define to the full name and version of this package. */ | | /* Define to the full name and version of this package. */ | |
|
| #define PACKAGE_STRING "pam_ssh 1.98" | | #define PACKAGE_STRING "pam_ssh 2.0" | |
| | | | |
| /* Define to the one symbol short name of this package. */ | | /* Define to the one symbol short name of this package. */ | |
| #define PACKAGE_TARNAME "pam_ssh" | | #define PACKAGE_TARNAME "pam_ssh" | |
| | | | |
| /* Define to the home page for this package. */ | | /* Define to the home page for this package. */ | |
| #define PACKAGE_URL "" | | #define PACKAGE_URL "" | |
| | | | |
| /* Define to the version of this package. */ | | /* Define to the version of this package. */ | |
|
| #define PACKAGE_VERSION "1.98" | | #define PACKAGE_VERSION "2.0" | |
| | | | |
| /* Path to ssh-agent */ | | /* Path to ssh-agent */ | |
| #define PATH_SSH_AGENT "/usr/bin/ssh-agent" | | #define PATH_SSH_AGENT "/usr/bin/ssh-agent" | |
| | | | |
|
| | | /* */ | |
| | | /* #undef SSH_AGENT_GROUP_NAME */ | |
| | | | |
| /* Define to 1 if you have the ANSI C header files. */ | | /* Define to 1 if you have the ANSI C header files. */ | |
| #define STDC_HEADERS 1 | | #define STDC_HEADERS 1 | |
| | | | |
| /* Version number of package */ | | /* Version number of package */ | |
|
| #define VERSION "1.98" | | #define VERSION "2.0" | |
| | | | |
| /* Define to empty if `const' does not conform to ANSI C. */ | | /* Define to empty if `const' does not conform to ANSI C. */ | |
| /* #undef const */ | | /* #undef const */ | |
| | | | |
| /* Define to `int' if <sys/types.h> doesn't define. */ | | /* Define to `int' if <sys/types.h> doesn't define. */ | |
| /* #undef gid_t */ | | /* #undef gid_t */ | |
| | | | |
| /* Define to `long int' if <sys/types.h> does not define. */ | | /* Define to `long int' if <sys/types.h> does not define. */ | |
| /* #undef off_t */ | | /* #undef off_t */ | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 3 lines changed or deleted | | 21 lines changed or added | |
|
| kex.h | | kex.h | |
|
| | | /* $OpenBSD: kex.h,v 1.52 2010/09/22 05:01:29 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions | | * modification, are permitted provided that the following conditions | |
| * are met: | | * are met: | |
| * 1. Redistributions of source code must retain the above copyright | | * 1. Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * 2. Redistributions in binary form must reproduce the above copyright | | * 2. Redistributions in binary form must reproduce the above copyright | |
| * notice, this list of conditions and the following disclaimer in the | | * notice, this list of conditions and the following disclaimer in the | |
| | | | |
| skipping to change at line 27 | | skipping to change at line 29 | |
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| #ifndef KEX_H | | #ifndef KEX_H | |
| #define KEX_H | | #define KEX_H | |
| | | | |
|
| #define KEX_DH1 "diffie-hellman-group1-sha1" | | #include <signal.h> | |
| #define KEX_DHGEX "diffie-hellman-group-exchange-sha1" | | #include <openssl/evp.h> | |
| | | #include <openssl/hmac.h> | |
| | | #ifdef OPENSSL_HAS_ECC | |
| | | #include <openssl/ec.h> | |
| | | #endif | |
| | | | |
| | | #define KEX_COOKIE_LEN 16 | |
| | | | |
| | | #define KEX_DH1 "diffie-hellman-group1-sha1" | |
| | | #define KEX_DH14 "diffie-hellman-group14-sha1" | |
| | | #define KEX_DHGEX_SHA1 "diffie-hellman-group-exchange-sha1" | |
| | | #define KEX_DHGEX_SHA256 "diffie-hellman-group-exchange-sha25 | |
| | | 6" | |
| | | #define KEX_RESUME "resume@appgate.com" | |
| | | /* The following represents the family of ECDH methods */ | |
| | | #define KEX_ECDH_SHA2_STEM "ecdh-sha2-" | |
| | | | |
| | | #define COMP_NONE 0 | |
| | | #define COMP_ZLIB 1 | |
| | | #define COMP_DELAYED 2 | |
| | | | |
| enum kex_init_proposals { | | enum kex_init_proposals { | |
| PROPOSAL_KEX_ALGS, | | PROPOSAL_KEX_ALGS, | |
| PROPOSAL_SERVER_HOST_KEY_ALGS, | | PROPOSAL_SERVER_HOST_KEY_ALGS, | |
| PROPOSAL_ENC_ALGS_CTOS, | | PROPOSAL_ENC_ALGS_CTOS, | |
| PROPOSAL_ENC_ALGS_STOC, | | PROPOSAL_ENC_ALGS_STOC, | |
| PROPOSAL_MAC_ALGS_CTOS, | | PROPOSAL_MAC_ALGS_CTOS, | |
| PROPOSAL_MAC_ALGS_STOC, | | PROPOSAL_MAC_ALGS_STOC, | |
| PROPOSAL_COMP_ALGS_CTOS, | | PROPOSAL_COMP_ALGS_CTOS, | |
| PROPOSAL_COMP_ALGS_STOC, | | PROPOSAL_COMP_ALGS_STOC, | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 72 | |
| }; | | }; | |
| | | | |
| enum kex_modes { | | enum kex_modes { | |
| MODE_IN, | | MODE_IN, | |
| MODE_OUT, | | MODE_OUT, | |
| MODE_MAX | | MODE_MAX | |
| }; | | }; | |
| | | | |
| enum kex_exchange { | | enum kex_exchange { | |
| KEX_DH_GRP1_SHA1, | | KEX_DH_GRP1_SHA1, | |
|
| | | KEX_DH_GRP14_SHA1, | |
| KEX_DH_GEX_SHA1, | | KEX_DH_GEX_SHA1, | |
|
| | | KEX_DH_GEX_SHA256, | |
| | | KEX_ECDH_SHA2, | |
| KEX_MAX | | KEX_MAX | |
| }; | | }; | |
| | | | |
| #define KEX_INIT_SENT 0x0001 | | #define KEX_INIT_SENT 0x0001 | |
| | | | |
| typedef struct Kex Kex; | | typedef struct Kex Kex; | |
| typedef struct Mac Mac; | | typedef struct Mac Mac; | |
| typedef struct Comp Comp; | | typedef struct Comp Comp; | |
| typedef struct Enc Enc; | | typedef struct Enc Enc; | |
| typedef struct Newkeys Newkeys; | | typedef struct Newkeys Newkeys; | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 99 | |
| Cipher *cipher; | | Cipher *cipher; | |
| int enabled; | | int enabled; | |
| u_int key_len; | | u_int key_len; | |
| u_int block_size; | | u_int block_size; | |
| u_char *key; | | u_char *key; | |
| u_char *iv; | | u_char *iv; | |
| }; | | }; | |
| struct Mac { | | struct Mac { | |
| char *name; | | char *name; | |
| int enabled; | | int enabled; | |
|
| const EVP_MD *md; | | u_int mac_len; | |
| int mac_len; | | | |
| u_char *key; | | u_char *key; | |
|
| int key_len; | | u_int key_len; | |
| | | int type; | |
| | | const EVP_MD *evp_md; | |
| | | HMAC_CTX evp_ctx; | |
| | | struct umac_ctx *umac_ctx; | |
| }; | | }; | |
| struct Comp { | | struct Comp { | |
| int type; | | int type; | |
| int enabled; | | int enabled; | |
| char *name; | | char *name; | |
| }; | | }; | |
| struct Newkeys { | | struct Newkeys { | |
| Enc enc; | | Enc enc; | |
| Mac mac; | | Mac mac; | |
| Comp comp; | | Comp comp; | |
| }; | | }; | |
| struct Kex { | | struct Kex { | |
| u_char *session_id; | | u_char *session_id; | |
| u_int session_id_len; | | u_int session_id_len; | |
| Newkeys *newkeys[MODE_MAX]; | | Newkeys *newkeys[MODE_MAX]; | |
|
| int we_need; | | u_int we_need; | |
| int server; | | int server; | |
| char *name; | | char *name; | |
| int hostkey_type; | | int hostkey_type; | |
| int kex_type; | | int kex_type; | |
|
| | | int roaming; | |
| Buffer my; | | Buffer my; | |
| Buffer peer; | | Buffer peer; | |
|
| int done; | | sig_atomic_t done; | |
| int flags; | | int flags; | |
|
| | | const EVP_MD *evp_md; | |
| char *client_version_string; | | char *client_version_string; | |
| char *server_version_string; | | char *server_version_string; | |
| int (*verify_host_key)(Key *); | | int (*verify_host_key)(Key *); | |
|
| Key *(*load_host_key)(int); | | Key *(*load_host_public_key)(int); | |
| | | Key *(*load_host_private_key)(int); | |
| int (*host_key_index)(Key *); | | int (*host_key_index)(Key *); | |
| void (*kex[KEX_MAX])(Kex *); | | void (*kex[KEX_MAX])(Kex *); | |
| }; | | }; | |
| | | | |
|
| | | int kex_names_valid(const char *); | |
| | | | |
| Kex *kex_setup(char *[PROPOSAL_MAX]); | | Kex *kex_setup(char *[PROPOSAL_MAX]); | |
| void kex_finish(Kex *); | | void kex_finish(Kex *); | |
| | | | |
| void kex_send_kexinit(Kex *); | | void kex_send_kexinit(Kex *); | |
| void kex_input_kexinit(int, u_int32_t, void *); | | void kex_input_kexinit(int, u_int32_t, void *); | |
|
| void kex_derive_keys(Kex *, u_char *, BIGNUM *); | | void kex_derive_keys(Kex *, u_char *, u_int, BIGNUM *); | |
| | | | |
| Newkeys *kex_get_newkeys(int); | | Newkeys *kex_get_newkeys(int); | |
| | | | |
| void kexdh_client(Kex *); | | void kexdh_client(Kex *); | |
| void kexdh_server(Kex *); | | void kexdh_server(Kex *); | |
| void kexgex_client(Kex *); | | void kexgex_client(Kex *); | |
| void kexgex_server(Kex *); | | void kexgex_server(Kex *); | |
|
| | | void kexecdh_client(Kex *); | |
| | | void kexecdh_server(Kex *); | |
| | | | |
|
| u_char * | | void | |
| kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, | | kex_dh_hash(char *, char *, char *, int, char *, int, u_char *, int, | |
|
| BIGNUM *, BIGNUM *, BIGNUM *); | | BIGNUM *, BIGNUM *, BIGNUM *, u_char **, u_int *); | |
| u_char * | | void | |
| kexgex_hash(char *, char *, char *, int, char *, int, u_char *, int, | | kexgex_hash(const EVP_MD *, char *, char *, char *, int, char *, | |
| int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *, BIGNUM *); | | int, u_char *, int, int, int, int, BIGNUM *, BIGNUM *, BIGNUM *, | |
| | | BIGNUM *, BIGNUM *, u_char **, u_int *); | |
| | | #ifdef OPENSSL_HAS_ECC | |
| | | void | |
| | | kex_ecdh_hash(const EVP_MD *, const EC_GROUP *, char *, char *, char *, int | |
| | | , | |
| | | char *, int, u_char *, int, const EC_POINT *, const EC_POINT *, | |
| | | const BIGNUM *, u_char **, u_int *); | |
| | | int kex_ecdh_name_to_nid(const char *); | |
| | | const EVP_MD *kex_ecdh_name_to_evpmd(const char *); | |
| | | #else | |
| | | # define kex_ecdh_name_to_nid(x) (-1) | |
| | | # define kex_ecdh_name_to_evpmd(x) (NULL) | |
| | | #endif | |
| | | | |
| | | void | |
| | | derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]); | |
| | | | |
|
| #if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) | | #if defined(DEBUG_KEX) || defined(DEBUG_KEXDH) || defined(DEBUG_KEXECDH) | |
| void dump_digest(char *, u_char *, int); | | void dump_digest(char *, u_char *, int); | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 17 change blocks. |
| 15 lines changed or deleted | | 65 lines changed or added | |
|
| key.h | | key.h | |
|
| | | /* $OpenBSD: key.h,v 1.33 2010/10/28 11:22:09 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | |
| * | | * | |
| * Redistribution and use in source and binary forms, with or without | | * Redistribution and use in source and binary forms, with or without | |
| * modification, are permitted provided that the following conditions | | * modification, are permitted provided that the following conditions | |
| * are met: | | * are met: | |
| * 1. Redistributions of source code must retain the above copyright | | * 1. Redistributions of source code must retain the above copyright | |
| * notice, this list of conditions and the following disclaimer. | | * notice, this list of conditions and the following disclaimer. | |
| * 2. Redistributions in binary form must reproduce the above copyright | | * 2. Redistributions in binary form must reproduce the above copyright | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 29 | |
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE
, | |
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| */ | | */ | |
| #ifndef KEY_H | | #ifndef KEY_H | |
| #define KEY_H | | #define KEY_H | |
| | | | |
|
| | | #include "buffer.h" | |
| #include <openssl/rsa.h> | | #include <openssl/rsa.h> | |
| #include <openssl/dsa.h> | | #include <openssl/dsa.h> | |
|
| | | #ifdef OPENSSL_HAS_ECC | |
| | | #include <openssl/ec.h> | |
| | | #endif | |
| | | | |
| typedef struct Key Key; | | typedef struct Key Key; | |
| enum types { | | enum types { | |
| KEY_RSA1, | | KEY_RSA1, | |
| KEY_RSA, | | KEY_RSA, | |
| KEY_DSA, | | KEY_DSA, | |
|
| | | KEY_ECDSA, | |
| | | KEY_RSA_CERT, | |
| | | KEY_DSA_CERT, | |
| | | KEY_ECDSA_CERT, | |
| | | KEY_RSA_CERT_V00, | |
| | | KEY_DSA_CERT_V00, | |
| KEY_UNSPEC | | KEY_UNSPEC | |
| }; | | }; | |
| enum fp_type { | | enum fp_type { | |
| SSH_FP_SHA1, | | SSH_FP_SHA1, | |
| SSH_FP_MD5 | | SSH_FP_MD5 | |
| }; | | }; | |
| enum fp_rep { | | enum fp_rep { | |
| SSH_FP_HEX, | | SSH_FP_HEX, | |
|
| SSH_FP_BUBBLEBABBLE | | SSH_FP_BUBBLEBABBLE, | |
| | | SSH_FP_RANDOMART | |
| }; | | }; | |
| | | | |
| /* key is stored in external hardware */ | | /* key is stored in external hardware */ | |
| #define KEY_FLAG_EXT 0x0001 | | #define KEY_FLAG_EXT 0x0001 | |
| | | | |
|
| | | #define CERT_MAX_PRINCIPALS 256 | |
| | | struct KeyCert { | |
| | | Buffer certblob; /* Kept around for use on wire */ | |
| | | u_int type; /* SSH2_CERT_TYPE_USER or SSH2_CERT_TYPE_HOST | |
| | | */ | |
| | | u_int64_t serial; | |
| | | char *key_id; | |
| | | u_int nprincipals; | |
| | | char **principals; | |
| | | u_int64_t valid_after, valid_before; | |
| | | Buffer critical; | |
| | | Buffer extensions; | |
| | | Key *signature_key; | |
| | | }; | |
| | | | |
| struct Key { | | struct Key { | |
| int type; | | int type; | |
| int flags; | | int flags; | |
| RSA *rsa; | | RSA *rsa; | |
| DSA *dsa; | | DSA *dsa; | |
|
| | | int ecdsa_nid; /* NID of curve */ | |
| | | #ifdef OPENSSL_HAS_ECC | |
| | | EC_KEY *ecdsa; | |
| | | #else | |
| | | void *ecdsa; | |
| | | #endif | |
| | | struct KeyCert *cert; | |
| }; | | }; | |
| | | | |
|
| Key *key_new(int); | | Key *key_new(int); | |
| Key *key_new_private(int); | | ////void key_add_private(Key *); | |
| void key_free(Key *); | | Key *key_new_private(int); | |
| int key_equal(Key *, Key *); | | void key_free(Key *); | |
| char *key_type(Key *); | | ////Key *key_demote(const Key *); | |
| | | ////int key_equal_public(const Key *, const Key *); | |
| int key_type_from_name(char *); | | ////int key_equal(const Key *, const Key *); | |
| | | ////char *key_fingerprint(Key *, enum fp_type, enum fp_rep); | |
| | | ////u_char *key_fingerprint_raw(Key *, enum fp_type, u_int *); | |
| | | const char *key_type(const Key *); | |
| | | ////const char *key_cert_type(const Key *); | |
| | | ////int key_write(const Key *, FILE *); | |
| | | ////int key_read(Key *, char **); | |
| | | ////u_int key_size(const Key *); | |
| | | | |
| | | ////Key *key_generate(int, u_int); | |
| | | ////Key *key_from_private(const Key *); | |
| | | ////int key_type_from_name(char *); | |
| | | int key_is_cert(const Key *); | |
| | | ////int key_type_plain(int); | |
| | | ////int key_to_certified(Key *, int); | |
| | | ////int key_drop_cert(Key *); | |
| | | ////int key_certify(Key *, Key *); | |
| | | ////void key_cert_copy(const Key *, struct Key *); | |
| | | ////int key_cert_check_authority(const Key *, int, int, const char | |
| | | *, | |
| | | //// const char **); | |
| | | ////int key_cert_is_legacy(Key *); | |
| | | | |
| | | ////int key_ecdsa_nid_from_name(const char *); | |
| | | ////int key_curve_name_to_nid(const char *); | |
| | | const char * key_curve_nid_to_name(int); | |
| | | u_int key_curve_nid_to_bits(int); | |
| | | ////int key_ecdsa_bits_to_nid(int); | |
| | | #ifdef OPENSSL_HAS_ECC | |
| | | int key_ecdsa_key_to_nid(EC_KEY *); | |
| | | ////const EVP_MD * key_ec_nid_to_evpmd(int nid); | |
| | | int key_ec_validate_public(const EC_GROUP *, const EC_POINT *); | |
| | | int key_ec_validate_private(const EC_KEY *); | |
| | | #endif | |
| | | | |
|
| char *key_ssh_name(Key *); | | ////Key *key_from_blob(const u_char *, u_int); | |
| | | ////int key_to_blob(const Key *, u_char **, u_int *); | |
| | | const char *key_ssh_name(const Key *); | |
| | | ////const char *key_ssh_name_plain(const Key *); | |
| | | ////int key_names_valid2(const char *); | |
| | | | |
| | | ////int key_sign(const Key *, u_char **, u_int *, const u_char *, u | |
| | | _int); | |
| | | ////int key_verify(const Key *, const u_char *, u_int, const u_char | |
| | | *, u_int); | |
| | | | |
| | | ////int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char | |
| | | *, u_int); | |
| | | ////int ssh_dss_verify(const Key *, const u_char *, u_int, const u_ | |
| | | char *, u_int); | |
| | | ////int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_cha | |
| | | r *, u_int); | |
| | | ////int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const | |
| | | u_char *, u_int); | |
| | | ////int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char | |
| | | *, u_int); | |
| | | ////int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_ | |
| | | char *, u_int); | |
| | | | |
| | | #if defined(OPENSSL_HAS_ECC) && (defined(DEBUG_KEXECDH) || defined(DEBUG_PK | |
| | | )) | |
| | | ////void key_dump_ec_point(const EC_GROUP *, const EC_POINT *); | |
| | | ////void key_dump_ec_key(const EC_KEY *); | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 9 change blocks. |
| 9 lines changed or deleted | | 104 lines changed or added | |
|
| log.h | | log.h | |
|
| | | /* $OpenBSD: log.h,v 1.18 2011/06/17 21:44:30 djm Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| * called by a name other than "ssh" or "Secure Shell". | | * called by a name other than "ssh" or "Secure Shell". | |
| */ | | */ | |
| | | | |
| #ifndef SSH_LOG_H | | #ifndef SSH_LOG_H | |
| #define SSH_LOG_H | | #define SSH_LOG_H | |
| | | | |
|
| #include <stdarg.h> | | #ifdef error | |
| | | #undef error | |
| #if !defined(HAVE___func__) && defined(HAVE___FUNCTION__) | | | |
| # define __func__ __FUNCTION__ | | | |
| #elif !defined(HAVE___func__) | | | |
| # define __func__ "" | | | |
| #endif | | #endif | |
|
| | | #define error unambigous_log_error | |
| | | | |
| /* Supported syslog facilities and levels. */ | | /* Supported syslog facilities and levels. */ | |
| typedef enum { | | typedef enum { | |
| SYSLOG_FACILITY_DAEMON, | | SYSLOG_FACILITY_DAEMON, | |
| SYSLOG_FACILITY_USER, | | SYSLOG_FACILITY_USER, | |
| SYSLOG_FACILITY_AUTH, | | SYSLOG_FACILITY_AUTH, | |
| #ifdef LOG_AUTHPRIV | | #ifdef LOG_AUTHPRIV | |
| SYSLOG_FACILITY_AUTHPRIV, | | SYSLOG_FACILITY_AUTHPRIV, | |
| #endif | | #endif | |
| SYSLOG_FACILITY_LOCAL0, | | SYSLOG_FACILITY_LOCAL0, | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 54 | |
| SYSLOG_LEVEL_FATAL, | | SYSLOG_LEVEL_FATAL, | |
| SYSLOG_LEVEL_ERROR, | | SYSLOG_LEVEL_ERROR, | |
| SYSLOG_LEVEL_INFO, | | SYSLOG_LEVEL_INFO, | |
| SYSLOG_LEVEL_VERBOSE, | | SYSLOG_LEVEL_VERBOSE, | |
| SYSLOG_LEVEL_DEBUG1, | | SYSLOG_LEVEL_DEBUG1, | |
| SYSLOG_LEVEL_DEBUG2, | | SYSLOG_LEVEL_DEBUG2, | |
| SYSLOG_LEVEL_DEBUG3, | | SYSLOG_LEVEL_DEBUG3, | |
| SYSLOG_LEVEL_NOT_SET = -1 | | SYSLOG_LEVEL_NOT_SET = -1 | |
| } LogLevel; | | } LogLevel; | |
| | | | |
|
| | | typedef void (log_handler_fn)(LogLevel, const char *, void *); | |
| | | | |
| void log_init(char *, LogLevel, SyslogFacility, int); | | void log_init(char *, LogLevel, SyslogFacility, int); | |
| | | | |
| SyslogFacility log_facility_number(char *); | | SyslogFacility log_facility_number(char *); | |
|
| LogLevel log_level_number(char *); | | const char * log_facility_name(SyslogFacility); | |
| | | LogLevel log_level_number(char *); | |
| void fatal(const char *, ...) __attribute__((format(printf, 1, 2))); | | const char * log_level_name(LogLevel); | |
| void error(const char *, ...) __attribute__((format(printf, 1, 2))); | | | |
| | | void fatal(const char *, ...) __attribute__((noreturn)) | |
| | | __attribute__((format(printf, 1, 2))); | |
| | | void unambigous_log_error(const char *, ...) __attribute__((format(prin | |
| | | tf, 1, 2))); | |
| | | void sigdie(const char *, ...) __attribute__((noreturn)) | |
| | | __attribute__((format(printf, 1, 2))); | |
| void logit(const char *, ...) __attribute__((format(printf, 1, 2))); | | void logit(const char *, ...) __attribute__((format(printf, 1, 2))); | |
| void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); | | void verbose(const char *, ...) __attribute__((format(printf, 1, 2))); | |
| void debug(const char *, ...) __attribute__((format(printf, 1, 2))); | | void debug(const char *, ...) __attribute__((format(printf, 1, 2))); | |
| void debug2(const char *, ...) __attribute__((format(printf, 1, 2))); | | void debug2(const char *, ...) __attribute__((format(printf, 1, 2))); | |
| void debug3(const char *, ...) __attribute__((format(printf, 1, 2))); | | void debug3(const char *, ...) __attribute__((format(printf, 1, 2))); | |
| | | | |
|
| void fatal_cleanup(void); | | void set_log_handler(log_handler_fn *, void *); | |
| void fatal_add_cleanup(void (*) (void *), void *); | | void do_log2(LogLevel, const char *, ...) | |
| void fatal_remove_cleanup(void (*) (void *), void *); | | __attribute__((format(printf, 2, 3))); | |
| void fatal_remove_all_cleanups(void); | | | |
| | | | |
| void do_log(LogLevel, const char *, va_list); | | void do_log(LogLevel, const char *, va_list); | |
|
| | | void cleanup_exit(int) __attribute__((noreturn)); | |
| #endif | | #endif | |
| | | | |
End of changes. 7 change blocks. |
| 16 lines changed or deleted | | 20 lines changed or added | |
|
| xmalloc.h | | xmalloc.h | |
|
| | | /* $OpenBSD: xmalloc.h,v 1.13 2006/08/03 03:34:42 deraadt Exp $ */ | |
| | | | |
| /* | | /* | |
| * Author: Tatu Ylonen <ylo@cs.hut.fi> | | * Author: Tatu Ylonen <ylo@cs.hut.fi> | |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | |
| * All rights reserved | | * All rights reserved | |
| * Created: Mon Mar 20 22:09:17 1995 ylo | | * Created: Mon Mar 20 22:09:17 1995 ylo | |
| * | | * | |
| * Versions of malloc and friends that check their results, and never retur
n | | * Versions of malloc and friends that check their results, and never retur
n | |
| * failure (they call fatal if they encounter an error). | | * failure (they call fatal if they encounter an error). | |
| * | | * | |
| * As far as I am concerned, the code I have written for this software | | * As far as I am concerned, the code I have written for this software | |
| * can be used freely for any purpose. Any derived versions of this | | * can be used freely for any purpose. Any derived versions of this | |
| * software must be clearly marked as such, and if the derived work is | | * software must be clearly marked as such, and if the derived work is | |
| * incompatible with the protocol description in the RFC file, it must be | | * incompatible with the protocol description in the RFC file, it must be | |
| * called by a name other than "ssh" or "Secure Shell". | | * called by a name other than "ssh" or "Secure Shell". | |
| */ | | */ | |
| | | | |
|
| #ifndef XMALLOC_H | | | |
| #define XMALLOC_H | | | |
| | | | |
| void *xmalloc(size_t); | | void *xmalloc(size_t); | |
|
| void *xrealloc(void *, size_t); | | void *xcalloc(size_t, size_t); | |
| | | void *xrealloc(void *, size_t, size_t); | |
| void xfree(void *); | | void xfree(void *); | |
| char *xstrdup(const char *); | | char *xstrdup(const char *); | |
|
| | | int xasprintf(char **, const char *, ...) | |
| #endif /* XMALLOC_H */ | | __attribute__((__format__ (printf, 2, 3))) | |
| | | __attribute__((__nonnull__ (2))); | |
| | | | |
End of changes. 4 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|