Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 646272
Collapse All | Expand All

(-)a/cipher.c.orig (-42 / +2 lines)
Lines 46-60 Link Here
46
#include "log.h"
46
#include "log.h"
47
#include "xmalloc.h"
47
#include "xmalloc.h"
48
48
49
#if OPENSSL_VERSION_NUMBER < 0x00906000L
50
#define SSH_OLD_EVP
51
#define EVP_CIPHER_CTX_get_app_data(e)          ((e)->app_data)
52
#endif
53
49
54
#if OPENSSL_VERSION_NUMBER < 0x00907000L
55
extern const EVP_CIPHER *evp_rijndael(void);
56
extern void ssh_rijndael_iv(EVP_CIPHER_CTX *, int, u_char *, u_int);
57
#endif
58
extern const EVP_CIPHER *evp_ssh1_bf(void);
50
extern const EVP_CIPHER *evp_ssh1_bf(void);
59
extern const EVP_CIPHER *evp_ssh1_3des(void);
51
extern const EVP_CIPHER *evp_ssh1_3des(void);
60
extern void ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int);
52
extern void ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int);
Lines 68-100 Link Here
68
	u_int	key_len;
60
	u_int	key_len;
69
	const EVP_CIPHER	*(*evptype)(void);
61
	const EVP_CIPHER	*(*evptype)(void);
70
} ciphers[] = {
62
} ciphers[] = {
71
	{ "none", 		SSH_CIPHER_NONE, 8, 0, EVP_enc_null },
72
	{ "des", 		SSH_CIPHER_DES, 8, 8, EVP_des_cbc },
73
	{ "3des", 		SSH_CIPHER_3DES, 8, 16, evp_ssh1_3des },
74
	{ "blowfish", 		SSH_CIPHER_BLOWFISH, 8, 32, evp_ssh1_bf },
75
76
	{ "3des-cbc", 		SSH_CIPHER_SSH2, 8, 24, EVP_des_ede3_cbc },
77
	{ "blowfish-cbc", 	SSH_CIPHER_SSH2, 8, 16, EVP_bf_cbc },
63
	{ "blowfish-cbc", 	SSH_CIPHER_SSH2, 8, 16, EVP_bf_cbc },
78
	{ "cast128-cbc", 	SSH_CIPHER_SSH2, 8, 16, EVP_cast5_cbc },
64
	{ "cast128-cbc", 	SSH_CIPHER_SSH2, 8, 16, EVP_cast5_cbc },
79
	{ "arcfour", 		SSH_CIPHER_SSH2, 8, 16, EVP_rc4 },
65
80
#if OPENSSL_VERSION_NUMBER < 0x00907000L
81
	{ "aes128-cbc", 	SSH_CIPHER_SSH2, 16, 16, evp_rijndael },
82
	{ "aes192-cbc", 	SSH_CIPHER_SSH2, 16, 24, evp_rijndael },
83
	{ "aes256-cbc", 	SSH_CIPHER_SSH2, 16, 32, evp_rijndael },
84
	{ "rijndael-cbc@lysator.liu.se",
85
				SSH_CIPHER_SSH2, 16, 32, evp_rijndael },
86
#else
87
	{ "aes128-cbc",		SSH_CIPHER_SSH2, 16, 16, EVP_aes_128_cbc },
66
	{ "aes128-cbc",		SSH_CIPHER_SSH2, 16, 16, EVP_aes_128_cbc },
88
	{ "aes192-cbc",		SSH_CIPHER_SSH2, 16, 24, EVP_aes_192_cbc },
67
	{ "aes192-cbc",		SSH_CIPHER_SSH2, 16, 24, EVP_aes_192_cbc },
89
	{ "aes256-cbc",		SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
68
	{ "aes256-cbc",		SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
90
	{ "rijndael-cbc@lysator.liu.se",
69
	{ "rijndael-cbc@lysator.liu.se",
91
				SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
70
				SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
92
#endif
71
93
#if OPENSSL_VERSION_NUMBER >= 0x00906000L
94
	{ "aes128-ctr", 	SSH_CIPHER_SSH2, 16, 16, evp_aes_128_ctr },
72
	{ "aes128-ctr", 	SSH_CIPHER_SSH2, 16, 16, evp_aes_128_ctr },
95
	{ "aes192-ctr", 	SSH_CIPHER_SSH2, 16, 24, evp_aes_128_ctr },
73
	{ "aes192-ctr", 	SSH_CIPHER_SSH2, 16, 24, evp_aes_128_ctr },
96
	{ "aes256-ctr", 	SSH_CIPHER_SSH2, 16, 32, evp_aes_128_ctr },
74
	{ "aes256-ctr", 	SSH_CIPHER_SSH2, 16, 32, evp_aes_128_ctr },
97
#endif
98
75
99
	{ NULL,			SSH_CIPHER_ILLEGAL, 0, 0, NULL }
76
	{ NULL,			SSH_CIPHER_ILLEGAL, 0, 0, NULL }
100
};
77
};
Lines 307-319 Link Here
307
	memset(&md, 0, sizeof(md));
284
	memset(&md, 0, sizeof(md));
308
}
285
}
309
286
310
#if OPENSSL_VERSION_NUMBER < 0x00907000L
311
#define EVP_X_STATE(evp)	&(evp).c
312
#define EVP_X_STATE_LEN(evp)	sizeof((evp).c)
313
#else
314
#define EVP_X_STATE(evp)	(evp).cipher_data
287
#define EVP_X_STATE(evp)	(evp).cipher_data
315
#define EVP_X_STATE_LEN(evp)	(evp).cipher->ctx_size
288
#define EVP_X_STATE_LEN(evp)	(evp).cipher->ctx_size
316
#endif
317
289
318
int
290
int
319
cipher_get_keycontext(CipherContext *cc, u_char *dat)
291
cipher_get_keycontext(CipherContext *cc, u_char *dat)
Lines 321-332 Link Here
321
	Cipher *c = cc->cipher;
293
	Cipher *c = cc->cipher;
322
	int plen = 0;
294
	int plen = 0;
323
295
324
	if (c->evptype == EVP_rc4) {
325
		plen = EVP_X_STATE_LEN(cc->evp);
326
		if (dat == NULL)
327
			return (plen);
328
		memcpy(dat, EVP_X_STATE(cc->evp), plen);
329
	}
330
	return (plen);
296
	return (plen);
331
}
297
}
332
298
Lines 334-343 Link Here
334
cipher_set_keycontext(CipherContext *cc, u_char *dat)
300
cipher_set_keycontext(CipherContext *cc, u_char *dat)
335
{
301
{
336
	Cipher *c = cc->cipher;
302
	Cipher *c = cc->cipher;
337
	int plen;
338
339
	if (c->evptype == EVP_rc4) {
340
		plen = EVP_X_STATE_LEN(cc->evp);
341
		memcpy(EVP_X_STATE(cc->evp), dat, plen);
342
	}
343
}
303
}

Return to bug 646272