diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-09-24 19:20:33 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-09-24 19:20:33 +0200 |
commit | ddbddbd80c80b872cdd36a01f9a3a6bc2eca1b1f (patch) | |
tree | d01f764d0b5956c84c6a56b0d99a7654d53d1d63 /source3 | |
parent | d4baa2a6bb997d572563ba684454e2cdd6c23a65 (diff) | |
download | samba-ddbddbd80c80b872cdd36a01f9a3a6bc2eca1b1f.tar.gz samba-ddbddbd80c80b872cdd36a01f9a3a6bc2eca1b1f.tar.bz2 samba-ddbddbd80c80b872cdd36a01f9a3a6bc2eca1b1f.zip |
Fix build with arc4.
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/ntlmssp_sign.c | 46 | ||||
-rw-r--r-- | source3/libsmb/smbdes.c | 3 |
2 files changed, 29 insertions, 20 deletions
diff --git a/source3/libsmb/ntlmssp_sign.c b/source3/libsmb/ntlmssp_sign.c index 5120544058..d3d358d332 100644 --- a/source3/libsmb/ntlmssp_sign.c +++ b/source3/libsmb/ntlmssp_sign.c @@ -35,6 +35,12 @@ * */ +static void dump_arc4_state(const char *description, + struct arcfour_state *state) +{ + dump_data_pw(description, state->sbox, sizeof(state->sbox)); +} + static void calc_ntlmv2_key(unsigned char subkey[16], DATA_BLOB session_key, const char *constant) @@ -124,8 +130,7 @@ static NTSTATUS ntlmssp_make_packet_signature(NTLMSSP_STATE *ntlmssp_state, ntlmssp_state->ntlmv1_seq_num++; - dump_data_pw("ntlmssp hash:\n", ntlmssp_state->ntlmv1_arc4_state, - sizeof(ntlmssp_state->ntlmv1_arc4_state)); + dump_arc4_state("ntlmssp hash: \n", &ntlmssp_state->ntlmv1_arc4_state); arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4); } return NT_STATUS_OK; @@ -274,12 +279,12 @@ NTSTATUS ntlmssp_seal_packet(NTLMSSP_STATE *ntlmssp_state, then seal the sequence number - this is becouse the ntlmv1_arc4_state is not constant, but is is rather updated with each iteration */ - dump_data_pw("ntlmv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state, - sizeof(ntlmssp_state->ntlmv1_arc4_state)); + dump_arc4_state("ntlmv1 arc4 state:\n", + &ntlmssp_state->ntlmv1_arc4_state); 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)); + dump_arc4_state("ntlmv1 arc4 state:\n", + &ntlmssp_state->ntlmv1_arc4_state); arcfour_crypt_sbox(&ntlmssp_state->ntlmv1_arc4_state, sig->data+4, sig->length-4); @@ -349,6 +354,7 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state) const char *send_seal_const; const char *recv_sign_const; const char *recv_seal_const; + DATA_BLOB send_seal_key_blob, recv_seal_blob; switch (ntlmssp_state->role) { case NTLMSSP_CLIENT: @@ -397,12 +403,13 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state) dump_data_pw("NTLMSSP send seal key:\n", ntlmssp_state->send_seal_key, 16); - arcfour_init(&ntlmssp_state->send_seal_arc4_state, - ntlmssp_state->send_seal_key, 16); + send_seal_key_blob.data = ntlmssp_state->send_seal_key; + send_seal_key_blob.length = 16; + arcfour_init(&ntlmssp_state->send_seal_arc4_state, + &send_seal_key_blob); - dump_data_pw("NTLMSSP send seal arc4 state:\n", - ntlmssp_state->send_seal_arc4_state, - sizeof(ntlmssp_state->send_seal_arc4_state)); + dump_arc4_state("NTLMSSP send seal arc4 state:\n", + &ntlmssp_state->send_seal_arc4_state); /* RECV: sign key */ calc_ntlmv2_key(ntlmssp_state->recv_sign_key, @@ -417,12 +424,13 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state) dump_data_pw("NTLMSSP recv seal key:\n", ntlmssp_state->recv_seal_key, 16); + recv_seal_blob.data = ntlmssp_state->recv_seal_key; + recv_seal_blob.length = 16; arcfour_init(&ntlmssp_state->recv_seal_arc4_state, - ntlmssp_state->recv_seal_key, 16); + &recv_seal_blob); - dump_data_pw("NTLMSSP recv seal arc4 state:\n", - ntlmssp_state->recv_seal_arc4_state, - sizeof(ntlmssp_state->recv_seal_arc4_state)); + dump_arc4_state("NTLMSSP recv seal arc4 state:\n", + &ntlmssp_state->recv_seal_arc4_state); ntlmssp_state->ntlm2_send_seq_num = 0; ntlmssp_state->ntlm2_recv_seq_num = 0; @@ -454,11 +462,11 @@ NTSTATUS ntlmssp_sign_init(NTLMSSP_STATE *ntlmssp_state) DEBUG(5, ("NTLMSSP Sign/Seal - using NTLM1\n")); - arcfour_init(&ntlmssp_state->ntlmv1_arc4_state, - weak_session_key.data, weak_session_key.length); + arcfour_init(&ntlmssp_state->ntlmv1_arc4_state, + &weak_session_key); - dump_data_pw("NTLMv1 arc4 state:\n", ntlmssp_state->ntlmv1_arc4_state, - sizeof(ntlmssp_state->ntlmv1_arc4_state)); + dump_arc4_state("NTLMv1 arc4 state:\n", + &ntlmssp_state->ntlmv1_arc4_state); ntlmssp_state->ntlmv1_seq_num = 0; } diff --git a/source3/libsmb/smbdes.c b/source3/libsmb/smbdes.c index 4869fc54a4..76779e2d27 100644 --- a/source3/libsmb/smbdes.c +++ b/source3/libsmb/smbdes.c @@ -389,8 +389,9 @@ void des_crypt112_16(unsigned char out[16], unsigned char in[16], const unsigned void SamOEMhash( unsigned char *data, const unsigned char key[16], size_t len) { struct arcfour_state arc4_state; + DATA_BLOB keyblob = { key, 16 }; - arcfour_init(&arc4_state, key, 16); + arcfour_init(&arc4_state, &keyblob); arcfour_crypt_sbox(&arc4_state, data, len); } |