X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshdes.c;h=6906a6581d95073f1491f98fc1e2332851d0887f;hb=d83cd2f79bba111660262af0827296cb76e17040;hp=de5d35a790ed970d095d1b61660835f474f66941;hpb=208213117a472a600f62c3ed71a2b3f3cb292384;p=PuTTY.git diff --git a/sshdes.c b/sshdes.c index de5d35a7..6906a658 100644 --- a/sshdes.c +++ b/sshdes.c @@ -743,19 +743,19 @@ static void des_sdctr3(unsigned char *dest, const unsigned char *src, iv0 = scheds->iv0; iv1 = scheds->iv1; for (i = 0; i < len; i += 8) { - des_encipher(b, iv0, iv1, &scheds[2]); + des_encipher(b, iv0, iv1, &scheds[0]); des_decipher(b, b[0], b[1], &scheds[1]); - des_encipher(b, b[0], b[1], &scheds[0]); + des_encipher(b, b[0], b[1], &scheds[2]); tmp = GET_32BIT_MSB_FIRST(src); PUT_32BIT_MSB_FIRST(dest, tmp ^ b[0]); src += 4; dest += 4; tmp = GET_32BIT_MSB_FIRST(src); - PUT_32BIT_MSB_FIRST(dest, tmp ^ b[0]); + PUT_32BIT_MSB_FIRST(dest, tmp ^ b[1]); src += 4; dest += 4; - if ((iv0 = (iv0 + 1) & 0xffffffff) == 0) - iv1 = (iv1 + 1) & 0xffffffff; + if ((iv1 = (iv1 + 1) & 0xffffffff) == 0) + iv0 = (iv0 + 1) & 0xffffffff; } scheds->iv0 = iv0; scheds->iv1 = iv1; @@ -961,17 +961,15 @@ static const struct ssh2_cipher ssh_3des_ssh2 = { des3_make_context, des3_free_context, des3_iv, des3_key, des3_ssh2_encrypt_blk, des3_ssh2_decrypt_blk, "3des-cbc", - 8, 168, "triple-DES CBC" + 8, 168, SSH_CIPHER_IS_CBC, "triple-DES CBC" }; -#ifndef ENABLE_3DES_SSH2_CTR static const struct ssh2_cipher ssh_3des_ssh2_ctr = { des3_make_context, des3_free_context, des3_iv, des3_key, des3_ssh2_sdctr, des3_ssh2_sdctr, "3des-ctr", - 8, 168, "triple-DES SDCTR" + 8, 168, 0, "triple-DES SDCTR" }; -#endif /* * Single DES in SSH-2. "des-cbc" is marked as HISTORIC in @@ -985,26 +983,18 @@ static const struct ssh2_cipher ssh_des_ssh2 = { des_make_context, des3_free_context, des3_iv, des_key, des_ssh2_encrypt_blk, des_ssh2_decrypt_blk, "des-cbc", - 8, 56, "single-DES CBC" + 8, 56, SSH_CIPHER_IS_CBC, "single-DES CBC" }; static const struct ssh2_cipher ssh_des_sshcom_ssh2 = { des_make_context, des3_free_context, des3_iv, des_key, des_ssh2_encrypt_blk, des_ssh2_decrypt_blk, "des-cbc@ssh.com", - 8, 56, "single-DES CBC" + 8, 56, SSH_CIPHER_IS_CBC, "single-DES CBC" }; -/* - * "3des-ctr" is disabled because it hasn't had any interoperability - * testing, which is in turn because I couldn't find another implementation - * to test against. Once it's been tested, it can be enabled in standard - * builds. - */ static const struct ssh2_cipher *const des3_list[] = { -#ifndef ENABLE_3DES_SSH2_CTR &ssh_3des_ssh2_ctr, -#endif &ssh_3des_ssh2 };