summaryrefslogtreecommitdiff
path: root/source3/arcfour.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-20 01:10:45 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-20 01:10:45 +0000
commit7d711a6d0d3e2a974c00cdaa622f8b8d9fd35def (patch)
treece6c7c7c20c623ff348553f0b4c7728ac9052607 /source3/arcfour.c
parent62b73f0913894ce7cf6e327cb9928a283f305403 (diff)
downloadsamba-7d711a6d0d3e2a974c00cdaa622f8b8d9fd35def.tar.gz
samba-7d711a6d0d3e2a974c00cdaa622f8b8d9fd35def.tar.bz2
samba-7d711a6d0d3e2a974c00cdaa622f8b8d9fd35def.zip
I am removing these from the source code in preparation for an
upcoming 1.9.18alpha release. We can't release with this code in there as it currently stands as it might breach ITAR export restrictions in the US. I've discussed ways around this with Jeremy and we can put the code back in with appropriate modifications once it is needed. Note that this code isn't actually used in Samba yet, so removing it has no effect. If anyone wants the code then look in ~samba-bugs/arcfour/ or grab it from the CVS attic. (This used to be commit 426cd6b2ded4725186a9262f13a327d8cf94364b)
Diffstat (limited to 'source3/arcfour.c')
-rw-r--r--source3/arcfour.c91
1 files changed, 0 insertions, 91 deletions
diff --git a/source3/arcfour.c b/source3/arcfour.c
deleted file mode 100644
index a28d702a86..0000000000
--- a/source3/arcfour.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- Unix SMB/Netbios implementation.
- Version 1.9.
-
- a implementation of arcfour designed for use in the
- SMB password change protocol based on the description
- in 'Applied Cryptography', 2nd Edition.
-
- Copyright (C) Jeremy Allison 1997
-
- 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.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "arcfour.h"
-
-void set_arc4_key(unsigned char *data, int key_length, arc4_key *arckey)
-{
- unsigned int i;
- unsigned char j;
- unsigned char tc;
- unsigned char *s_box = &arckey->s_box[0];
-
- arckey->index_i = 0;
- arckey->index_j = 0;
- for(i = 0; i < 256; i++)
- s_box[i] = (unsigned char)i;
-
- j = 0;
- for( i = 0; i < 256; i++)
- {
- j += (s_box[i] + data[i%key_length]);
- tc = s_box[i];
- s_box[i] = s_box[j];
- s_box[j] = tc;
- }
-}
-
-void arc4(arc4_key *arckey, unsigned char *data_in, unsigned char *data_out,
- int length)
-{
- unsigned char tc;
- int ind;
- unsigned char i, j;
- unsigned char t;
- unsigned char *s_box = &arckey->s_box[0];
-
- for( ind = 0; ind < length; ind++)
- {
- i = ++arckey->index_i;
- j = arckey->index_j += s_box[i];
- tc = s_box[i];
- s_box[i] = s_box[j];
- s_box[j] = tc;
- t = s_box[i] + s_box[j];
- *data_out++ = *data_in++ ^ s_box[t];
- }
-}
-
-#if 0
-/* Test vector */
-unsigned char key_data[] = { 0x61, 0x8a, 0x63, 0xd2, 0xfb };
-unsigned char plaintext[] = { 0xdc, 0xee, 0x4c, 0xf9, 0x2c };
-unsigned char ciphertext[] = { 0xf1, 0x38, 0x29, 0xc9, 0xde };
-
-int main(int argc, char *argv[])
-{
- unsigned char out[5];
- arc4_key key;
-
- set_arc4_key(key_data, 5, &key);
- arc4(&key, plaintext, out, 5);
-
- if(memcmp(out, ciphertext, 5) ==0)
- printf("Test ok !\n");
- else
- printf("Test fail !\n");
- return 0;
-}
-#endif