summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ntlm.h17
-rw-r--r--src/ntlm_crypto.c25
2 files changed, 42 insertions, 0 deletions
diff --git a/src/ntlm.h b/src/ntlm.h
index a771123..40508e4 100644
--- a/src/ntlm.h
+++ b/src/ntlm.h
@@ -413,6 +413,23 @@ int ntlm_unseal(struct ntlm_rc4_handle *handle, uint32_t flags,
struct ntlm_buffer *message, struct ntlm_buffer *output,
struct ntlm_buffer *signature);
+/**
+ * @brief Creates a NTLM MIC
+ *
+ * @param exported_session_key The Exported Session Key
+ * @param negotiate_message The NTLM Negotiate Message (or empty)
+ * @param challenge_message The NTLM Challenge Message
+ * @param authenticate_message The NTLM Authenticate Message
+ * @param mic Preallocated byffer of 16 bytes
+ *
+ * @return 0 on success, or an error
+ */
+int ntlm_mic(struct ntlm_key *exported_session_key,
+ struct ntlm_buffer *negotiate_message,
+ struct ntlm_buffer *challenge_message,
+ struct ntlm_buffer *authenticate_message,
+ struct ntlm_buffer *mic);
+
/* ############## ENCODING / DECODING ############## */
/**
diff --git a/src/ntlm_crypto.c b/src/ntlm_crypto.c
index 46b7d97..fbfdc41 100644
--- a/src/ntlm_crypto.c
+++ b/src/ntlm_crypto.c
@@ -805,3 +805,28 @@ int ntlm_unseal(struct ntlm_rc4_handle *handle, uint32_t flags,
(flags & NTLMSSP_NEGOTIATE_KEY_EXCH),
output, signature);
}
+
+int ntlm_mic(struct ntlm_key *exported_session_key,
+ struct ntlm_buffer *negotiate_message,
+ struct ntlm_buffer *challenge_message,
+ struct ntlm_buffer *authenticate_message,
+ struct ntlm_buffer *mic)
+{
+ struct ntlm_buffer key = { exported_session_key->data,
+ exported_session_key->length };
+ struct ntlm_buffer *data[3] = { negotiate_message,
+ challenge_message,
+ authenticate_message };
+ struct ntlm_iov iov;
+
+ if (negotiate_message->length == 0) {
+ /* connectionless case */
+ iov.data = &data[1];
+ iov.num = 2;
+ } else {
+ iov.data = data;
+ iov.num = 3;
+ }
+
+ return HMAC_MD5_IOV(&key, &iov, mic);
+}