summaryrefslogtreecommitdiff
path: root/source4/libcli/util/smbdes.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-08-20 07:59:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:33:37 -0500
commit684c824e9ac51ee2d6b748973757697a8ead2634 (patch)
tree5db08a22f4d5ae8707a44ce06e910ed7742dca1b /source4/libcli/util/smbdes.c
parent6baa6e0aa8dfd539a4fa3185a055eb8b1f4896c0 (diff)
downloadsamba-684c824e9ac51ee2d6b748973757697a8ead2634.tar.gz
samba-684c824e9ac51ee2d6b748973757697a8ead2634.tar.bz2
samba-684c824e9ac51ee2d6b748973757697a8ead2634.zip
r9421: Move arcfour code into it's own file, in lib/crypto.
Andrew Bartlett (This used to be commit ca6cf462708810637544d4b4bef0f404fb89a002)
Diffstat (limited to 'source4/libcli/util/smbdes.c')
-rw-r--r--source4/libcli/util/smbdes.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/source4/libcli/util/smbdes.c b/source4/libcli/util/smbdes.c
index d214d4cfe4..d02cae602f 100644
--- a/source4/libcli/util/smbdes.c
+++ b/source4/libcli/util/smbdes.c
@@ -365,73 +365,6 @@ void des_crypt112_16(uint8_t out[16], uint8_t in[16], const uint8_t key[14], int
des_crypt56(out + 8, in + 8, key+7, forw);
}
-/* initialise the arcfour sbox with key */
-void arcfour_init(struct arcfour_state *state, const DATA_BLOB *key)
-{
- int ind;
- uint8_t j = 0;
- for (ind = 0; ind < sizeof(state->sbox); ind++) {
- state->sbox[ind] = (uint8_t)ind;
- }
-
- for (ind = 0; ind < sizeof(state->sbox); ind++) {
- uint8_t tc;
-
- j += (state->sbox[ind] + key->data[ind%key->length]);
-
- tc = state->sbox[ind];
- state->sbox[ind] = state->sbox[j];
- state->sbox[j] = tc;
- }
- state->index_i = 0;
- state->index_j = 0;
-}
-
-/* crypt the data with arcfour */
-void arcfour_crypt_sbox(struct arcfour_state *state, uint8_t *data, int len)
-{
- int ind;
-
- for (ind = 0; ind < len; ind++) {
- uint8_t tc;
- uint8_t t;
-
- state->index_i++;
- state->index_j += state->sbox[state->index_i];
-
- tc = state->sbox[state->index_i];
- state->sbox[state->index_i] = state->sbox[state->index_j];
- state->sbox[state->index_j] = tc;
-
- t = state->sbox[state->index_i] + state->sbox[state->index_j];
- data[ind] = data[ind] ^ state->sbox[t];
- }
-}
-
-/*
- arcfour encryption with a blob key
-*/
-void arcfour_crypt_blob(uint8_t *data, int len, const DATA_BLOB *key)
-{
- struct arcfour_state state;
- arcfour_init(&state, key);
- arcfour_crypt_sbox(&state, data, len);
-}
-
-/*
- a variant that assumes a 16 byte key. This should be removed
- when the last user is gone
-*/
-void arcfour_crypt(uint8_t *data, const uint8_t keystr[16], int len)
-{
- DATA_BLOB key = data_blob(keystr, 16);
-
- arcfour_crypt_blob(data, len, &key);
-
- data_blob_free(&key);
-}
-
-
/* Decode a sam password hash into a password. The password hash is the
same method used to store passwords in the NT registry. The DES key
used is based on the RID of the user. */