summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/auth/session.c12
-rw-r--r--source4/torture/rpc/lsa.c8
2 files changed, 10 insertions, 10 deletions
diff --git a/source4/libcli/auth/session.c b/source4/libcli/auth/session.c
index 946b0fe62f..77eb1a6527 100644
--- a/source4/libcli/auth/session.c
+++ b/source4/libcli/auth/session.c
@@ -29,7 +29,7 @@
before calling, the out blob must be initialised to be the same size
as the in blob
*/
-void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const uint8 session_key[16],
+void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const DATA_BLOB *session_key,
BOOL forward)
{
int i, k;
@@ -42,10 +42,10 @@ void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const uint8 session_ke
memset(bin, 0, 8);
memcpy(bin, &in->data[i], MIN(8, in->length-i));
- if (k + 7 > 16) {
- k = (16 - k);
+ if (k + 7 > session_key->length) {
+ k = (session_key->length - k);
}
- memcpy(key, &session_key[k], 7);
+ memcpy(key, &session_key->data[k], 7);
smbhash(bout, bin, key, forward?1:0);
@@ -62,7 +62,7 @@ void sess_crypt_blob(DATA_BLOB *out, const DATA_BLOB *in, const uint8 session_ke
caller should free using data_blob_free()
*/
-DATA_BLOB sess_encrypt_string(const char *str, const uint8 session_key[16])
+DATA_BLOB sess_encrypt_string(const char *str, const DATA_BLOB *session_key)
{
DATA_BLOB ret, src;
int slen = strlen(str);
@@ -96,7 +96,7 @@ DATA_BLOB sess_encrypt_string(const char *str, const uint8 session_key[16])
caller should free the returned string
*/
-char *sess_decrypt_string(DATA_BLOB *blob, const uint8 session_key[16])
+char *sess_decrypt_string(DATA_BLOB *blob, const DATA_BLOB *session_key)
{
DATA_BLOB out;
int slen;
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 0b5f825ac2..679e1dbac8 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -334,7 +334,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p,
struct lsa_DATA_BUF_PTR bufp1;
DATA_BLOB enc_key;
BOOL ret = True;
- uint8 session_key[16];
+ DATA_BLOB session_key;
NTTIME old_mtime, new_mtime;
DATA_BLOB blob1, blob2;
const char *secret1 = "abcdef12345699qwerty";
@@ -370,13 +370,13 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p,
ret = False;
}
- status = dcerpc_fetch_session_key(p, session_key);
+ status = dcerpc_fetch_session_key(p, &session_key);
if (!NT_STATUS_IS_OK(status)) {
printf("dcerpc_fetch_session_key failed - %s\n", nt_errstr(status));
ret = False;
}
- enc_key = sess_encrypt_string(secret1, session_key);
+ enc_key = sess_encrypt_string(secret1, &session_key);
r3.in.handle = &sec_handle;
r3.in.new_val = &buf1;
@@ -418,7 +418,7 @@ static BOOL test_CreateSecret(struct dcerpc_pipe *p,
blob2 = data_blob(NULL, blob1.length);
- secret2 = sess_decrypt_string(&blob1, session_key);
+ secret2 = sess_decrypt_string(&blob1, &session_key);
printf("returned secret '%s'\n", secret2);