X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/54eb0b3e135cb27a700bb96b4764bd29f3004b27..5c58ad2d1527936b4d30891497eef48bde0fe1f3:/sshblowf.c diff --git a/sshblowf.c b/sshblowf.c index 7b97496b..d6e6731f 100644 --- a/sshblowf.c +++ b/sshblowf.c @@ -392,6 +392,30 @@ static void blowfish_setkey(BlowfishContext *ctx, #define SSH_SESSION_KEY_LENGTH 32 static BlowfishContext ectx, dctx; +static void blowfish_cskey(unsigned char *key) +{ + blowfish_setkey(&ectx, key, 16); + logevent("Initialised Blowfish client->server encryption"); +} + +static void blowfish_sckey(unsigned char *key) +{ + blowfish_setkey(&dctx, key, 16); + logevent("Initialised Blowfish server->client encryption"); +} + +static void blowfish_csiv(unsigned char *key) +{ + ectx.iv0 = GET_32BIT_LSB_FIRST(key); + ectx.iv1 = GET_32BIT_LSB_FIRST(key+4); +} + +static void blowfish_sciv(unsigned char *key) +{ + dctx.iv0 = GET_32BIT_LSB_FIRST(key); + dctx.iv1 = GET_32BIT_LSB_FIRST(key+4); +} + static void blowfish_sesskey(unsigned char *key) { blowfish_setkey(&ectx, key, SSH_SESSION_KEY_LENGTH); @@ -413,6 +437,10 @@ static void blowfish_decrypt_blk(unsigned char *blk, int len) struct ssh_cipher ssh_blowfish = { blowfish_sesskey, + blowfish_csiv, blowfish_cskey, + blowfish_sciv, blowfish_sckey, blowfish_encrypt_blk, - blowfish_decrypt_blk + blowfish_decrypt_blk, + "blowfish-cbc", + 8 };