1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-25 14:50:24 +03:00

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)
This commit is contained in:
Andrew Tridgell 1997-10-20 01:10:45 +00:00
parent 62b73f0913
commit 7d711a6d0d
2 changed files with 0 additions and 130 deletions

View File

@ -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

View File

@ -1,39 +0,0 @@
#ifndef _ARC4_H_
#define _ARC4_H_
/*
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.
*/
typedef struct {
unsigned char s_box[256];
unsigned char index_i;
unsigned char index_j;
} arc4_key;
extern void set_arc4_key(unsigned char *data, int key_length, arc4_key *arckey);
extern void arc4(arc4_key *arckey, unsigned char *data_in,
unsigned char *data_out, int length);
#endif /* _ARC4_H_ */