/***********************************************************
Decode an arc4 encrypted password change buffer.
************************************************************/
-void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key);
+NTSTATUS encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532],
+ const DATA_BLOB *psession_key);
/***********************************************************
encode a password buffer with an already unicode password. The
Decode an arc4 encrypted password change buffer.
************************************************************/
-void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key)
+NTSTATUS encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532],
+ const DATA_BLOB *psession_key)
{
gnutls_hash_hd_t hash_hnd = NULL;
unsigned char key_out[16];
+ NTSTATUS status;
int rc;
/* Confounder is last 16 bytes. */
rc = gnutls_hash_init(&hash_hnd, GNUTLS_DIG_MD5);
if (rc < 0) {
+ status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
goto out;
}
rc = gnutls_hash(hash_hnd, &pw_buf[516], 16);
if (rc < 0) {
gnutls_hash_deinit(hash_hnd, NULL);
+ status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
goto out;
}
rc = gnutls_hash(hash_hnd, psession_key->data, psession_key->length);
if (rc < 0) {
gnutls_hash_deinit(hash_hnd, NULL);
+ status = gnutls_error_to_ntstatus(rc, NT_STATUS_HASH_NOT_SUPPORTED);
goto out;
}
gnutls_hash_deinit(hash_hnd, key_out);
ZERO_ARRAY(key_out);
+ status = NT_STATUS_OK;
out:
- return;
+ return status;
}
/***********************************************************
if(!NT_STATUS_IS_OK(status)) {
break;
}
- encode_or_decode_arc4_passwd_buffer(
+ status = encode_or_decode_arc4_passwd_buffer(
info->info25.password.data,
&session_key);
+ if (!NT_STATUS_IS_OK(status)) {
+ break;
+ }
dump_data(100, info->info25.password.data, 532);
if(!NT_STATUS_IS_OK(status)) {
break;
}
- encode_or_decode_arc4_passwd_buffer(
+ status = encode_or_decode_arc4_passwd_buffer(
info->info26.password.data,
&session_key);
+ if (!NT_STATUS_IS_OK(status)) {
+ break;
+ }
dump_data(100, info->info26.password.data, 516);