X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/37508af4ab231b1fde58345f5237f3ee82803829..74091dffae1760356be823c68fa307cd93c4c30b:/sshdes.c diff --git a/sshdes.c b/sshdes.c index 66e70416..83d4d26a 100644 --- a/sshdes.c +++ b/sshdes.c @@ -16,26 +16,6 @@ information. */ -/* - * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $ - * $Log: sshdes.c,v $ - * Revision 1.2 1999/01/08 13:10:15 simon - * John Sullivan's patches plus more fixes: - * - Stop using the identifier `environ' as some platforms make it a macro - * - Fix silly error box at end of connection in FWHACK mode - * - Fix GPF on maximise-then-restore - * - Use SetCapture to allow drag-selecting outside the window - * - Correctly update window title when iconic and in win_name_always mode - * - * Revision 1.1.1.1 1996/02/18 21:38:11 ylo - * Imported ssh-1.2.13. - * - * Revision 1.2 1995/07/13 01:22:57 ylo - * Added cvs log. - * - * $Endlog$ - */ - typedef struct { word32 key_schedule[32]; @@ -115,26 +95,6 @@ cryptography and data security, including the following: */ -/* - * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $ - * $Log: sshdes.c,v $ - * Revision 1.2 1999/01/08 13:10:15 simon - * John Sullivan's patches plus more fixes: - * - Stop using the identifier `environ' as some platforms make it a macro - * - Fix silly error box at end of connection in FWHACK mode - * - Fix GPF on maximise-then-restore - * - Use SetCapture to allow drag-selecting outside the window - * - Correctly update window title when iconic and in win_name_always mode - * - * Revision 1.1.1.1 1996/02/18 21:38:11 ylo - * Imported ssh-1.2.13. - * - * Revision 1.2 1995/07/13 01:22:25 ylo - * Added cvs log. - * - * $Endlog$ - */ - /* Table for key generation. This used to be in sk.h. */ /* Copyright (C) 1993 Eric Young - see README for more details */ static const word32 des_skb[8][64]={ @@ -697,6 +657,7 @@ static void des3_sesskey(unsigned char *key) { memset(div1, 0, sizeof(div1)); memset(div2, 0, sizeof(div2)); memset(div3, 0, sizeof(div3)); + logevent("Initialised triple-DES encryption"); } static void des3_encrypt_blk(unsigned char *blk, int len) { @@ -713,6 +674,28 @@ struct ssh_cipher ssh_3des = { des3_decrypt_blk }; +static void des_sesskey(unsigned char *key) { + des_set_key(key, &ekey1); + memset(eiv1, 0, sizeof(eiv1)); + des_set_key(key, &dkey1); + memset(div1, 0, sizeof(div1)); + logevent("Initialised single-DES encryption"); +} + +static void des_encrypt_blk(unsigned char *blk, int len) { + des_cbc_encrypt(&ekey1, eiv1, blk, blk, len); +} + +static void des_decrypt_blk(unsigned char *blk, int len) { + des_cbc_decrypt(&dkey1, div1, blk, blk, len); +} + +struct ssh_cipher ssh_des = { + des_sesskey, + des_encrypt_blk, + des_decrypt_blk +}; + #ifdef DES_TEST void des_encrypt_buf(DESContext *ks, unsigned char *out,