Merge branch 'master' of ssh://git.samba.org/data/git/samba into arc4
authorJelmer Vernooij <jelmer@samba.org>
Wed, 24 Sep 2008 16:38:45 +0000 (18:38 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 24 Sep 2008 16:38:45 +0000 (18:38 +0200)
Conflicts:
source3/include/includes.h

1  2 
source3/Makefile.in
source3/include/includes.h
source3/include/proto.h
source3/libsmb/ntlmssp_sign.c

diff --combined source3/Makefile.in
index d48e597ce362010494218670f5fd168affcbd07e,9e0a1179f3ba76e36e64ab182cc7e83d49f24c68..b8ce0523dd43422dc6759eb4425f050b6f96b365
@@@ -320,7 -320,7 +320,7 @@@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) 
          lib/signal.o lib/system.o lib/sendfile.o lib/recvfile.o lib/time.o \
          lib/ufc.o lib/genrand.o lib/username.o \
          lib/util_pw.o lib/access.o lib/smbrun.o \
-         lib/bitmap.o lib/crc32.o lib/dprintf.o \
+         lib/bitmap.o ../lib/crypto/crc32.o lib/dprintf.o \
          lib/xfile.o lib/wins_srv.o $(UTIL_REG_OBJ) \
          lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \
          lib/util_unistr.o lib/util_file.o lib/data_blob.o \
          lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \
          lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \
          lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
 -        ../lib/crypto/md5.o ../lib/crypto/hmacmd5.o lib/arc4.o lib/iconv.o \
 -        lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
 +        ../lib/crypto/md5.o ../lib/crypto/hmacmd5.o ../lib/crypto/arcfour.o \
 +        lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
          lib/adt_tree.o lib/gencache.o \
          lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
          lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o \
index 25135d75ed50b0c4623d4a0bc2a353af1dec53b0,79495a7ecf678f8175703f6c6d28060e2e63e1a8..0417a7e01c000366b5c613ff64ff776923efa5e7
@@@ -687,7 -687,7 +687,8 @@@ typedef char fstring[FSTRING_LEN]
  #include "msdfs.h"
  #include "rap.h"
  #include "../lib/crypto/md5.h"
 +#include "../lib/crypto/arcfour.h"
+ #include "../lib/crypto/crc32.h"
  #include "../lib/crypto/hmacmd5.h"
  #include "ntlmssp.h"
  #include "auth.h"
diff --combined source3/include/proto.h
index ad7350c5d15a1a67895594a9aa4091e38fd9c7b4,b1c4d2e5d9f678bef5afd2e678d7290a9cc0845e..198248c5172704e1be0aca673f03b1906c6134eb
@@@ -312,6 -312,11 +312,6 @@@ int afs_syscall( int subcall
  bool afs_settoken_str(const char *token_string);
  bool afs_settoken_str(const char *token_string);
  
 -/* The following definitions come from lib/arc4.c  */
 -
 -void smb_arc4_init(unsigned char arc4_state_out[258], const unsigned char *key, size_t keylen);
 -void smb_arc4_crypt(unsigned char arc4_state_inout[258], unsigned char *data, size_t len);
 -
  /* The following definitions come from lib/audit.c  */
  
  const char *audit_category_str(uint32 category);
@@@ -432,10 -437,6 +432,6 @@@ int connections_forall(int (*fn)(struc
                       void *private_data);
  bool connections_init(bool rw);
  
- /* The following definitions come from lib/crc32.c  */
- uint32 crc32_calc_buffer(const char *buf, size_t size);
  /* The following definitions come from lib/data_blob.c  */
  
  DATA_BLOB data_blob(const void *p, size_t length);
index 4db5141cce0bb26a374e54a4f6d8a982e750a485,1abdf61b7f9e2a4e58cc4416d9e1cd851f3bd480..5120544058397ef6bbdfaf056f55eee001cb6dc3
@@@ -101,10 -101,10 +101,10 @@@ static NTSTATUS ntlmssp_make_packet_sig
                if (encrypt_sig && (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH)) {
                        switch (direction) {
                        case NTLMSSP_SEND:
 -                              smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state,  digest, 8);
 +                              arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, digest, 8);
                                break;
                        case NTLMSSP_RECEIVE:
 -                              smb_arc4_crypt(ntlmssp_state->recv_seal_arc4_state,  digest, 8);
 +                              arcfour_crypt_sbox(&ntlmssp_state->recv_seal_arc4_state, digest, 8);
                                break;
                        }
                }
  
        } else {
                uint32 crc;
-               crc = crc32_calc_buffer((const char *)data, length);
+               crc = crc32_calc_buffer(data, length);
                if (!msrpc_gen(sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmv1_seq_num)) {
                        return NT_STATUS_NO_MEMORY;
                }
  
                dump_data_pw("ntlmssp hash:\n", ntlmssp_state->ntlmv1_arc4_state,
                             sizeof(ntlmssp_state->ntlmv1_arc4_state));
 -              smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
 +              arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
        }
        return NT_STATUS_OK;
  }
@@@ -259,13 -259,13 +259,13 @@@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_ST
                        return nt_status;
                }
  
 -              smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state, data, length);
 +              arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, data, length);
                if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCH) {
 -                      smb_arc4_crypt(ntlmssp_state->send_seal_arc4_state, sig->data+4, 8);
 +                      arcfour_crypt_sbox(&ntlmssp_state->send_seal_arc4_state, sig->data+4, 8);
                }
        } else {
                uint32 crc;
-               crc = crc32_calc_buffer((const char *)data, length);
+               crc = crc32_calc_buffer(data, length);
                if (!msrpc_gen(sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, ntlmssp_state->ntlmv1_seq_num)) {
                        return NT_STATUS_NO_MEMORY;
                }
                
                dump_data_pw("ntlmv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,
                             sizeof(ntlmssp_state->ntlmv1_arc4_state));
 -              smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, data, length);
 +              arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, data, length);
  
                dump_data_pw("ntlmv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,
                             sizeof(ntlmssp_state->ntlmv1_arc4_state));
  
 -              smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
 +              arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4);
  
                ntlmssp_state->ntlmv1_seq_num++;
        }
@@@ -311,10 -311,10 +311,10 @@@ NTSTATUS ntlmssp_unseal_packet(NTLMSSP_
  
        if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) {
                /* First unseal the data. */
 -              smb_arc4_crypt(ntlmssp_state->recv_seal_arc4_state, data, length);
 +              arcfour_crypt_sbox(&ntlmssp_state->recv_seal_arc4_state, data, length);
                dump_data_pw("ntlmv2 clear data\n", data, length);
        } else {
 -              smb_arc4_crypt(ntlmssp_state->ntlmv1_arc4_state, data, length);
 +              arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, data, length);
                dump_data_pw("ntlmv1 clear data\n", data, length);
        }
        return ntlmssp_check_packet(ntlmssp_state, data, length, whole_pdu, pdu_length, sig);
@@@ -397,7 -397,7 +397,7 @@@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STAT
                dump_data_pw("NTLMSSP send seal key:\n",
                                ntlmssp_state->send_seal_key, 16);
  
 -              smb_arc4_init(ntlmssp_state->send_seal_arc4_state,
 +              arcfour_init(&ntlmssp_state->send_seal_arc4_state,
                                ntlmssp_state->send_seal_key, 16);
  
                dump_data_pw("NTLMSSP send seal arc4 state:\n", 
                dump_data_pw("NTLMSSP recv seal key:\n",
                                ntlmssp_state->recv_seal_key, 16);
                                
 -              smb_arc4_init(ntlmssp_state->recv_seal_arc4_state,
 +              arcfour_init(&ntlmssp_state->recv_seal_arc4_state,
                                ntlmssp_state->recv_seal_key, 16);
  
                dump_data_pw("NTLMSSP recv seal arc4 state:\n", 
  
                DEBUG(5, ("NTLMSSP Sign/Seal - using NTLM1\n"));
  
 -              smb_arc4_init(ntlmssp_state->ntlmv1_arc4_state,
 +              arcfour_init(&ntlmssp_state->ntlmv1_arc4_state,
                               weak_session_key.data, weak_session_key.length);
  
                  dump_data_pw("NTLMv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state,