summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-04-02 17:23:41 -0400
committerSimo Sorce <simo@redhat.com>2014-05-04 17:21:06 -0400
commit21e17f374b2b223bf15fb4b3fa9c0e427677c3e4 (patch)
treedbbdfa87d140623a49318b997efa53fec438aac1 /src
parent85630731acc397079355d1aed94d04140c34a72c (diff)
downloadgss-ntlmssp-21e17f374b2b223bf15fb4b3fa9c0e427677c3e4.tar.gz
gss-ntlmssp-21e17f374b2b223bf15fb4b3fa9c0e427677c3e4.tar.xz
gss-ntlmssp-21e17f374b2b223bf15fb4b3fa9c0e427677c3e4.zip
Add internal facility to override standard version
This is useufl to use test vetors w/o altering them
Diffstat (limited to 'src')
-rw-r--r--src/ntlm.c27
-rw-r--r--src/ntlm.h12
2 files changed, 31 insertions, 8 deletions
diff --git a/src/ntlm.c b/src/ntlm.c
index 208a141..ca4a415 100644
--- a/src/ntlm.c
+++ b/src/ntlm.c
@@ -420,22 +420,33 @@ done:
return ret;
}
+struct wire_version ntlmssp_version = {
+ NTLMSSP_VERSION_MAJOR,
+ NTLMSSP_VERSION_MINOR,
+ NTLMSSP_VERSION_BUILD, /* 0 is always 0 even in LE */
+ { 0, 0, 0 },
+ NTLMSSP_VERSION_REV
+};
+
+void ntlm_internal_set_version(uint8_t major, uint8_t minor,
+ uint16_t build, uint8_t revision)
+{
+ ntlmssp_version.major = major;
+ ntlmssp_version.minor = minor;
+ ntlmssp_version.build = htole16(build);
+ ntlmssp_version.revision = revision;
+}
+
static int ntlm_encode_version(struct ntlm_ctx *ctx,
struct ntlm_buffer *buffer,
size_t *data_offs)
{
- struct wire_version *v;
-
if (*data_offs + sizeof(struct wire_version) > buffer->length) {
return ERR_ENCODE;
}
- v = (struct wire_version *)&buffer->data[*data_offs];
- v->major = NTLMSSP_VERSION_MAJOR;
- v->minor = NTLMSSP_VERSION_MINOR;
- v->build = htole16(NTLMSSP_VERSION_BUILD);
- v->revision = NTLMSSP_VERSION_REV;
-
+ memcpy(&buffer->data[*data_offs], &ntlmssp_version,
+ sizeof(struct wire_version));
*data_offs += sizeof(struct wire_version);
return 0;
}
diff --git a/src/ntlm.h b/src/ntlm.h
index e2d67a7..2275d62 100644
--- a/src/ntlm.h
+++ b/src/ntlm.h
@@ -103,6 +103,18 @@ uint64_t ntlm_timestamp_now(void);
bool ntlm_casecmp(const char *s1, const char *s2);
+/**
+ * @brief Sets the NTLMSSP version
+ * Mostly used to emulate Windows versions for test vectors
+ *
+ * @param major major version number (ex. 6)
+ * @param minor minor version number (ex. 1)
+ * @param build build version number (ex. 7600)
+ * @param revision revision version number (ex. 16)
+ */
+void ntlm_internal_set_version(uint8_t major, uint8_t minor,
+ uint16_t build, uint8_t revision);
+
/* ############### CRYPTO FUNCTIONS ################ */
struct ntlm_key {