diff options
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 43 |
1 files changed, 1 insertions, 42 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.c,v 1.247 2017/03/11 13:07:35 markus Exp $ */ | 1 | /* $OpenBSD: packet.c,v 1.248 2017/04/30 23:10:43 djm 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 |
@@ -811,34 +811,7 @@ uncompress_buffer(struct ssh *ssh, struct sshbuf *in, struct sshbuf *out) | |||
811 | void | 811 | void |
812 | ssh_packet_set_encryption_key(struct ssh *ssh, const u_char *key, u_int keylen, int number) | 812 | ssh_packet_set_encryption_key(struct ssh *ssh, const u_char *key, u_int keylen, int number) |
813 | { | 813 | { |
814 | #ifndef WITH_SSH1 | ||
815 | fatal("no SSH protocol 1 support"); | 814 | fatal("no SSH protocol 1 support"); |
816 | #else /* WITH_SSH1 */ | ||
817 | struct session_state *state = ssh->state; | ||
818 | const struct sshcipher *cipher = cipher_by_number(number); | ||
819 | int r; | ||
820 | const char *wmsg; | ||
821 | |||
822 | if (cipher == NULL) | ||
823 | fatal("%s: unknown cipher number %d", __func__, number); | ||
824 | if (keylen < 20) | ||
825 | fatal("%s: keylen too small: %d", __func__, keylen); | ||
826 | if (keylen > SSH_SESSION_KEY_LENGTH) | ||
827 | fatal("%s: keylen too big: %d", __func__, keylen); | ||
828 | memcpy(state->ssh1_key, key, keylen); | ||
829 | state->ssh1_keylen = keylen; | ||
830 | if ((r = cipher_init(&state->send_context, cipher, key, keylen, | ||
831 | NULL, 0, CIPHER_ENCRYPT)) != 0 || | ||
832 | (r = cipher_init(&state->receive_context, cipher, key, keylen, | ||
833 | NULL, 0, CIPHER_DECRYPT) != 0)) | ||
834 | fatal("%s: cipher_init failed: %s", __func__, ssh_err(r)); | ||
835 | if (!state->cipher_warning_done && | ||
836 | ((wmsg = cipher_warning_message(state->send_context)) != NULL || | ||
837 | (wmsg = cipher_warning_message(state->send_context)) != NULL)) { | ||
838 | error("Warning: %s", wmsg); | ||
839 | state->cipher_warning_done = 1; | ||
840 | } | ||
841 | #endif /* WITH_SSH1 */ | ||
842 | } | 815 | } |
843 | 816 | ||
844 | /* | 817 | /* |
@@ -2862,13 +2835,6 @@ sshpkt_put_ec(struct ssh *ssh, const EC_POINT *v, const EC_GROUP *g) | |||
2862 | } | 2835 | } |
2863 | #endif /* OPENSSL_HAS_ECC */ | 2836 | #endif /* OPENSSL_HAS_ECC */ |
2864 | 2837 | ||
2865 | #ifdef WITH_SSH1 | ||
2866 | int | ||
2867 | sshpkt_put_bignum1(struct ssh *ssh, const BIGNUM *v) | ||
2868 | { | ||
2869 | return sshbuf_put_bignum1(ssh->state->outgoing_packet, v); | ||
2870 | } | ||
2871 | #endif /* WITH_SSH1 */ | ||
2872 | 2838 | ||
2873 | int | 2839 | int |
2874 | sshpkt_put_bignum2(struct ssh *ssh, const BIGNUM *v) | 2840 | sshpkt_put_bignum2(struct ssh *ssh, const BIGNUM *v) |
@@ -2930,13 +2896,6 @@ sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g) | |||
2930 | } | 2896 | } |
2931 | #endif /* OPENSSL_HAS_ECC */ | 2897 | #endif /* OPENSSL_HAS_ECC */ |
2932 | 2898 | ||
2933 | #ifdef WITH_SSH1 | ||
2934 | int | ||
2935 | sshpkt_get_bignum1(struct ssh *ssh, BIGNUM *v) | ||
2936 | { | ||
2937 | return sshbuf_get_bignum1(ssh->state->incoming_packet, v); | ||
2938 | } | ||
2939 | #endif /* WITH_SSH1 */ | ||
2940 | 2899 | ||
2941 | int | 2900 | int |
2942 | sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v) | 2901 | sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v) |