From b71beefd5f2c3bbd62e3138bfa17b3392278fbc7 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Fri, 7 Nov 2003 21:03:11 +0000 Subject: [PATCH] Removed RC6 from distributions. --- CHANGES | 4 + apps/irssi/silc.conf | 1 - lib/silccrypt/Makefile.am | 2 - lib/silccrypt/ciphers.h | 1 - lib/silccrypt/rc6.c | 220 ----------------------------------- lib/silccrypt/rc6.h | 34 ------ lib/silccrypt/rc6_internal.h | 39 ------- lib/silccrypt/silccipher.c | 9 -- lib/silcsim/Makefile.am | 1 - win32/libsilc/libsilc.def | 5 - 10 files changed, 4 insertions(+), 312 deletions(-) delete mode 100644 lib/silccrypt/rc6.c delete mode 100644 lib/silccrypt/rc6.h delete mode 100644 lib/silccrypt/rc6_internal.h diff --git a/CHANGES b/CHANGES index f774e965..0536c5a4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +Fri Nov 7 23:01:47 EET 2003 Pekka Riikonen + + * Removed RC6 from distributions. + Fri Nov 7 19:38:42 EET 2003 Pekka Riikonen * Added some better comments to lib/silccrypt/silcpkcs.h, diff --git a/apps/irssi/silc.conf b/apps/irssi/silc.conf index c2bd1c69..ba405d71 100644 --- a/apps/irssi/silc.conf +++ b/apps/irssi/silc.conf @@ -196,7 +196,6 @@ statusbar = { # # aes-256-cbc, aes-192-cbc, aes-128-cbc, # twofish-256-cbc, twofish-192-cbc, twofish-128-cbc, -# rc6-256-cbc, rc6-192-cbc, rc6-128-cbc, # cast-256-cbc, cast-192-cbc and cast-128-cbc # # Available hash functions are (default: sha1): diff --git a/lib/silccrypt/Makefile.am b/lib/silccrypt/Makefile.am index 3dd281ca..d3e6e842 100644 --- a/lib/silccrypt/Makefile.am +++ b/lib/silccrypt/Makefile.am @@ -23,7 +23,6 @@ noinst_LTLIBRARIES = libsilccrypt.la libsilccrypt_la_SOURCES = \ none.c \ rc5.c \ - rc6.c \ md5.c \ aes.c \ rsa.c \ @@ -58,7 +57,6 @@ include_HEADERS = \ none.h \ pkcs1.h \ rc5.h \ - rc6.h \ rsa.h \ sha1.h \ silccipher.h \ diff --git a/lib/silccrypt/ciphers.h b/lib/silccrypt/ciphers.h index 2eb7edfc..94eeef68 100644 --- a/lib/silccrypt/ciphers.h +++ b/lib/silccrypt/ciphers.h @@ -23,7 +23,6 @@ #include "none.h" #include "rc5.h" -#include "rc6.h" #include "twofish.h" #include "aes.h" #include "blowfish.h" diff --git a/lib/silccrypt/rc6.c b/lib/silccrypt/rc6.c deleted file mode 100644 index 2ca7c83c..00000000 --- a/lib/silccrypt/rc6.c +++ /dev/null @@ -1,220 +0,0 @@ -/* Modified for SILC. -Pekka */ - -/* This is an independent implementation of the encryption algorithm: */ -/* */ -/* RC6 by Ron Rivest and RSA Labs */ -/* */ -/* which is a candidate algorithm in the Advanced Encryption Standard */ -/* programme of the US National Institute of Standards and Technology. */ -/* */ -/* Copyright in this implementation is held by Dr B R Gladman but I */ -/* hereby give permission for its free direct or derivative use subject */ -/* to acknowledgment of its origin and compliance with any conditions */ -/* that the originators of the algorithm place on its exploitation. */ -/* */ -/* Dr Brian Gladman (gladman@seven77.demon.co.uk) 14th January 1999 */ - -/* Timing data for RC6 (rc6.c) - -128 bit key: -Key Setup: 1632 cycles -Encrypt: 270 cycles = 94.8 mbits/sec -Decrypt: 226 cycles = 113.3 mbits/sec -Mean: 248 cycles = 103.2 mbits/sec - -192 bit key: -Key Setup: 1885 cycles -Encrypt: 267 cycles = 95.9 mbits/sec -Decrypt: 235 cycles = 108.9 mbits/sec -Mean: 251 cycles = 102.0 mbits/sec - -256 bit key: -Key Setup: 1877 cycles -Encrypt: 270 cycles = 94.8 mbits/sec -Decrypt: 227 cycles = 112.8 mbits/sec -Mean: 249 cycles = 103.0 mbits/sec - -*/ - -#include "silcincludes.h" -#include "rc6_internal.h" -#include "rc6.h" - -/* - * SILC Crypto API for RC6 - */ - -/* Sets the key for the cipher. */ - -SILC_CIPHER_API_SET_KEY(rc6) -{ - SilcUInt32 k[8]; - - SILC_GET_WORD_KEY(key, k, keylen); - rc6_set_key((RC6Context *)context, k, keylen); - - return TRUE; -} - -/* Sets the string as a new key for the cipher. The string is first - hashed and then used as a new key. */ - -SILC_CIPHER_API_SET_KEY_WITH_STRING(rc6) -{ - return FALSE; -} - -/* Encrypts with the cipher in CBC mode. Source and destination buffers - maybe one and same. */ - -SILC_CIPHER_API_ENCRYPT_CBC(rc6) -{ - SilcUInt32 tiv[4]; - int i; - - SILC_CBC_GET_IV(tiv, iv); - - SILC_CBC_ENC_PRE(tiv, src); - rc6_encrypt((RC6Context *)context, tiv, tiv); - SILC_CBC_ENC_POST(tiv, dst, src); - - for (i = 16; i < len; i += 16) { - SILC_CBC_ENC_PRE(tiv, src); - rc6_encrypt((RC6Context *)context, tiv, tiv); - SILC_CBC_ENC_POST(tiv, dst, src); - } - - SILC_CBC_PUT_IV(tiv, iv); - - return TRUE; -} - -/* Decrypts with the cipher in CBC mode. Source and destination buffers - maybe one and same. */ - -SILC_CIPHER_API_DECRYPT_CBC(rc6) -{ - SilcUInt32 tmp[4], tmp2[4], tiv[4]; - int i; - - SILC_CBC_GET_IV(tiv, iv); - - SILC_CBC_DEC_PRE(tmp, src); - rc6_decrypt((RC6Context *)context, tmp, tmp2); - SILC_CBC_DEC_POST(tmp2, dst, src, tmp, tiv); - - for (i = 16; i < len; i += 16) { - SILC_CBC_DEC_PRE(tmp, src); - rc6_decrypt((RC6Context *)context, tmp, tmp2); - SILC_CBC_DEC_POST(tmp2, dst, src, tmp, tiv); - } - - SILC_CBC_PUT_IV(tiv, iv); - - return TRUE; -} - -/* Returns the size of the cipher context. */ - -SILC_CIPHER_API_CONTEXT_LEN(rc6) -{ - return sizeof(RC6Context); -} - - -#define f_rnd(i,a,b,c,d) \ - u = rotl(d * (d + d + 1), 5); \ - t = rotl(b * (b + b + 1), 5); \ - a = rotl(a ^ t, u) + l_key[i]; \ - c = rotl(c ^ u, t) + l_key[i + 1] - -#define i_rnd(i,a,b,c,d) \ - u = rotl(d * (d + d + 1), 5); \ - t = rotl(b * (b + b + 1), 5); \ - c = rotr(c - l_key[i + 1], t) ^ u; \ - a = rotr(a - l_key[i], u) ^ t - -/* initialise the key schedule from the user supplied key */ - -u4byte *rc6_set_key(RC6Context *ctx, - const u4byte in_key[], const u4byte key_len) -{ - u4byte i, j, k, a, b, l[8], t; - u4byte *l_key = ctx->l_key; - - l_key[0] = 0xb7e15163; - - for(k = 1; k < 44; ++k) - - l_key[k] = l_key[k - 1] + 0x9e3779b9; - - for(k = 0; k < key_len / 32; ++k) - - l[k] = in_key[k]; - - t = (key_len / 32) - 1; /* t = (key_len / 32); */ - - a = b = i = j = 0; - - for(k = 0; k < 132; ++k) - { a = rotl(l_key[i] + a + b, 3); b += a; - b = rotl(l[j] + b, b); - l_key[i] = a; l[j] = b; - i = (i == 43 ? 0 : i + 1); /* i = (i + 1) % 44; */ - j = (j == t ? 0 : j + 1); /* j = (j + 1) % t; */ - } - - return l_key; -}; - -/* encrypt a block of text */ - -void rc6_encrypt(RC6Context *ctx, - const u4byte in_blk[4], u4byte out_blk[4]) -{ - u4byte a,b,c,d,t,u; - u4byte *l_key = ctx->l_key; - - a = in_blk[0]; b = in_blk[1] + l_key[0]; - c = in_blk[2]; d = in_blk[3] + l_key[1]; - - f_rnd( 2,a,b,c,d); f_rnd( 4,b,c,d,a); - f_rnd( 6,c,d,a,b); f_rnd( 8,d,a,b,c); - f_rnd(10,a,b,c,d); f_rnd(12,b,c,d,a); - f_rnd(14,c,d,a,b); f_rnd(16,d,a,b,c); - f_rnd(18,a,b,c,d); f_rnd(20,b,c,d,a); - f_rnd(22,c,d,a,b); f_rnd(24,d,a,b,c); - f_rnd(26,a,b,c,d); f_rnd(28,b,c,d,a); - f_rnd(30,c,d,a,b); f_rnd(32,d,a,b,c); - f_rnd(34,a,b,c,d); f_rnd(36,b,c,d,a); - f_rnd(38,c,d,a,b); f_rnd(40,d,a,b,c); - - out_blk[0] = a + l_key[42]; out_blk[1] = b; - out_blk[2] = c + l_key[43]; out_blk[3] = d; -}; - -/* decrypt a block of text */ - -void rc6_decrypt(RC6Context *ctx, - const u4byte in_blk[4], u4byte out_blk[4]) -{ - u4byte a,b,c,d,t,u; - u4byte *l_key = ctx->l_key; - - d = in_blk[3]; c = in_blk[2] - l_key[43]; - b = in_blk[1]; a = in_blk[0] - l_key[42]; - - i_rnd(40,d,a,b,c); i_rnd(38,c,d,a,b); - i_rnd(36,b,c,d,a); i_rnd(34,a,b,c,d); - i_rnd(32,d,a,b,c); i_rnd(30,c,d,a,b); - i_rnd(28,b,c,d,a); i_rnd(26,a,b,c,d); - i_rnd(24,d,a,b,c); i_rnd(22,c,d,a,b); - i_rnd(20,b,c,d,a); i_rnd(18,a,b,c,d); - i_rnd(16,d,a,b,c); i_rnd(14,c,d,a,b); - i_rnd(12,b,c,d,a); i_rnd(10,a,b,c,d); - i_rnd( 8,d,a,b,c); i_rnd( 6,c,d,a,b); - i_rnd( 4,b,c,d,a); i_rnd( 2,a,b,c,d); - - out_blk[3] = d - l_key[1]; out_blk[2] = c; - out_blk[1] = b - l_key[0]; out_blk[0] = a; -}; diff --git a/lib/silccrypt/rc6.h b/lib/silccrypt/rc6.h deleted file mode 100644 index c1d2ec0c..00000000 --- a/lib/silccrypt/rc6.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - - rc6.h - - Author: Pekka Riikonen - - Copyright (C) 1997 - 2000 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef RC6_H -#define RC6_H - -/* - * SILC Crypto API for RC6 - */ - -SILC_CIPHER_API_SET_KEY(rc6); -SILC_CIPHER_API_SET_KEY_WITH_STRING(rc6); -SILC_CIPHER_API_CONTEXT_LEN(rc6); -SILC_CIPHER_API_ENCRYPT_CBC(rc6); -SILC_CIPHER_API_DECRYPT_CBC(rc6); - -#endif diff --git a/lib/silccrypt/rc6_internal.h b/lib/silccrypt/rc6_internal.h deleted file mode 100644 index 1b693067..00000000 --- a/lib/silccrypt/rc6_internal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - - rc6_internal.h - - Author: Pekka Riikonen - - Copyright (C) 1997 - 2000 Pekka Riikonen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - -*/ - -#ifndef RC6_INTERNAL_H -#define RC6_INTERNAL_H - -#include "ciphers_def.h" - -/* Cipher's context */ -typedef struct { - u4byte l_key[44]; -} RC6Context; - -/* Prototypes */ -u4byte *rc6_set_key(RC6Context *ctx, - const u4byte in_key[], const u4byte key_len); -void rc6_encrypt(RC6Context *ctx, - const u4byte in_blk[4], u4byte out_blk[4]); -void rc6_decrypt(RC6Context *ctx, - const u4byte in_blk[4], u4byte out_blk[4]); - -#endif diff --git a/lib/silccrypt/silccipher.c b/lib/silccrypt/silccipher.c index 53c938b6..ddaeee01 100644 --- a/lib/silccrypt/silccipher.c +++ b/lib/silccrypt/silccipher.c @@ -58,15 +58,6 @@ const SilcCipherObject silc_default_ciphers[] = silc_twofish_set_key_with_string, silc_twofish_encrypt_cbc, silc_twofish_decrypt_cbc, silc_twofish_context_len }, - { "rc6-256-cbc", 16, 256, silc_rc6_set_key, silc_rc6_set_key_with_string, - silc_rc6_encrypt_cbc, silc_rc6_decrypt_cbc, - silc_rc6_context_len }, - { "rc6-192-cbc", 16, 192, silc_rc6_set_key, silc_rc6_set_key_with_string, - silc_rc6_encrypt_cbc, silc_rc6_decrypt_cbc, - silc_rc6_context_len }, - { "rc6-128-cbc", 16, 128, silc_rc6_set_key, silc_rc6_set_key_with_string, - silc_rc6_encrypt_cbc, silc_rc6_decrypt_cbc, - silc_rc6_context_len }, { "cast-256-cbc", 16, 256, silc_cast_set_key, silc_cast_set_key_with_string, silc_cast_encrypt_cbc, silc_cast_decrypt_cbc, silc_cast_context_len }, diff --git a/lib/silcsim/Makefile.am b/lib/silcsim/Makefile.am index 3e45d3d7..c4eb761f 100644 --- a/lib/silcsim/Makefile.am +++ b/lib/silcsim/Makefile.am @@ -35,7 +35,6 @@ SIM_CIPHER_OBJS = \ none.o \ blowfish.o \ rc5.o \ - rc6.o \ aes.o \ rsa.o \ twofish.o \ diff --git a/win32/libsilc/libsilc.def b/win32/libsilc/libsilc.def index 822bafd5..4f59ecf9 100644 --- a/win32/libsilc/libsilc.def +++ b/win32/libsilc/libsilc.def @@ -370,11 +370,6 @@ EXPORTS silc_rc5_encrypt_cbc @ 612 ; silc_rc5_set_key @ 613 ; silc_rc5_set_key_with_string @ 614 ; - silc_rc6_context_len @ 615 ; - silc_rc6_decrypt_cbc @ 616 ; - silc_rc6_encrypt_cbc @ 617 ; - silc_rc6_set_key @ 618 ; - silc_rc6_set_key_with_string @ 619 ; silc_realloc @ 620 ; silc_rng_add_noise @ 621 ; silc_rng_alloc @ 622 ; -- 2.43.0