summaryrefslogtreecommitdiff
path: root/cipher.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-21 00:43:42 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-21 00:43:42 +0000
commit402c6cc68170ee63d07c5ff4a081e113b1628445 (patch)
tree081f2f0e57c333e53c308abbfdce31b6ae3d2006 /cipher.c
parentcb72e4f6d2cf63cda22484ec90142689fed288f6 (diff)
downloadopenssh-git-402c6cc68170ee63d07c5ff4a081e113b1628445.tar.gz
- markus@cvs.openbsd.org 2002/06/19 18:01:00
[cipher.c monitor.c monitor_wrap.c packet.c packet.h] make the monitor sync the transfer ssh1 session key; transfer keycontext only for RC4 (this is still depends on EVP implementation details and is broken).
Diffstat (limited to 'cipher.c')
-rw-r--r--cipher.c37
1 files changed, 7 insertions, 30 deletions
diff --git a/cipher.c b/cipher.c
index 39807d5c..b18c701f 100644
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: cipher.c,v 1.58 2002/06/04 23:05:49 markus Exp $");
+RCSID("$OpenBSD: cipher.c,v 1.59 2002/06/19 18:01:00 markus Exp $");
#include "xmalloc.h"
#include "log.h"
@@ -689,28 +689,14 @@ int
cipher_get_keycontext(CipherContext *cc, u_char *dat)
{
Cipher *c = cc->cipher;
- int plen;
+ int plen = 0;
- if (c->number == SSH_CIPHER_3DES) {
- struct ssh1_3des_ctx *desc;
- desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
- if (desc == NULL)
- fatal("%s: no 3des context", __func__);
- plen = EVP_X_STATE_LEN(desc->k1);
+ if (c->evptype == EVP_rc4) {
+ plen = EVP_X_STATE_LEN(cc->evp);
if (dat == NULL)
- return (3*plen);
- memcpy(dat, EVP_X_STATE(desc->k1), plen);
- memcpy(dat + plen, EVP_X_STATE(desc->k2), plen);
- memcpy(dat + 2*plen, EVP_X_STATE(desc->k3), plen);
- return (3*plen);
+ return (plen);
+ memcpy(dat, EVP_X_STATE(cc->evp), plen);
}
-
- /* Generic EVP */
- plen = EVP_X_STATE_LEN(cc->evp);
- if (dat == NULL)
- return (plen);
-
- memcpy(dat, EVP_X_STATE(cc->evp), plen);
return (plen);
}
@@ -720,16 +706,7 @@ cipher_set_keycontext(CipherContext *cc, u_char *dat)
Cipher *c = cc->cipher;
int plen;
- if (c->number == SSH_CIPHER_3DES) {
- struct ssh1_3des_ctx *desc;
- desc = EVP_CIPHER_CTX_get_app_data(&cc->evp);
- if (desc == NULL)
- fatal("%s: no 3des context", __func__);
- plen = EVP_X_STATE_LEN(desc->k1);
- memcpy(EVP_X_STATE(desc->k1), dat, plen);
- memcpy(EVP_X_STATE(desc->k2), dat + plen, plen);
- memcpy(EVP_X_STATE(desc->k3), dat + 2*plen, plen);
- } else {
+ if (c->evptype == EVP_rc4) {
plen = EVP_X_STATE_LEN(cc->evp);
memcpy(EVP_X_STATE(cc->evp), dat, plen);
}