diff options
author | Simo Sorce <simo@redhat.com> | 2014-04-02 17:23:41 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2014-05-04 17:21:06 -0400 |
commit | 21e17f374b2b223bf15fb4b3fa9c0e427677c3e4 (patch) | |
tree | dbbdfa87d140623a49318b997efa53fec438aac1 /src | |
parent | 85630731acc397079355d1aed94d04140c34a72c (diff) | |
download | gss-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.c | 27 | ||||
-rw-r--r-- | src/ntlm.h | 12 |
2 files changed, 31 insertions, 8 deletions
@@ -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; } @@ -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 { |