annotate src/lib-ntlm/ntlm-encrypt.c @ 23017:c1d36f2575c7 default tip

lib-imap: Fix "Don't accept strings with NULs" cherry-pick
author Timo Sirainen <timo.sirainen@open-xchange.com>
date Thu, 29 Aug 2019 09:55:25 +0300
parents 8802322d7257
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 /*
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 * NTLM and NTLMv2 hash generation.
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3 *
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 * Copyright (c) 2004 Andrey Panin <pazke@donpac.ru>
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 *
4382
f8d37e26a2b3 Relicensed dovecot-auth to MIT.
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
6 * This software is released under the MIT license.
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7 */
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9 #include "lib.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 #include "buffer.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11 #include "compat.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 #include "safe-memset.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 #include "md4.h"
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
14 #include "md5.h"
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
15 #include "hmac.h"
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
16 #include "ntlm.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17 #include "ntlm-des.h"
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18
2387
d41d66244eb2 Moved system header includes after local headers to fix some compile problems.
Timo Sirainen <tss@iki.fi>
parents: 2381
diff changeset
19 #include <ctype.h>
d41d66244eb2 Moved system header includes after local headers to fix some compile problems.
Timo Sirainen <tss@iki.fi>
parents: 2381
diff changeset
20
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
21 static unsigned char *
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 2708
diff changeset
22 t_unicode_str(const char *src, bool ucase, size_t *size)
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
23 {
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
24 buffer_t *wstr;
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
25
2708
f1e9f3ec8135 Buffer API change: we no longer support limited sized buffers where
Timo Sirainen <tss@iki.fi>
parents: 2692
diff changeset
26 wstr = buffer_create_dynamic(unsafe_data_stack_pool, 32);
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
27 for ( ; *src; src++) {
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 buffer_append_c(wstr, ucase ? i_toupper(*src) : *src);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29 buffer_append_c(wstr, '\0');
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 *size = buffer_get_used_size(wstr);
6414
a6a49d5efc59 Changed buffer_free() and buffer_free_without_data() APIs to take ** pointer
Timo Sirainen <tss@iki.fi>
parents: 5609
diff changeset
33 return buffer_free_without_data(&wstr);
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35
14682
d0d7b810646b Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents: 14629
diff changeset
36 void lm_hash(const char *passwd, unsigned char hash[LM_HASH_SIZE])
2381
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
37 {
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
38 static const unsigned char lm_magic[8] = "KGS!@#$%";
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
39 unsigned char buffer[14];
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
40 unsigned int i;
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
41
2654
b522b7cea776 compiler warning fix
Timo Sirainen <tss@iki.fi>
parents: 2523
diff changeset
42 strncpy((char *)buffer, passwd, sizeof(buffer));
2381
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
43
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
44 for (i = 0; i < sizeof(buffer); i++)
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
45 buffer[i] = i_toupper(buffer[i]);
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
46
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
47 deshash(hash, buffer, lm_magic);
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
48 deshash(hash + 8, buffer + 7, lm_magic);
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
49
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
50 safe_memset(buffer, 0, sizeof(buffer));
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
51 }
6531fd0f779f Added LANMAN password scheme. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2377
diff changeset
52
14682
d0d7b810646b Make sure we check all the functions' return values. Minor API changes to simplify this.
Timo Sirainen <tss@iki.fi>
parents: 14629
diff changeset
53 void ntlm_v1_hash(const char *passwd, unsigned char hash[NTLMSSP_HASH_SIZE])
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54 {
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 size_t len;
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 void *wpwd = t_unicode_str(passwd, 0, &len);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
57
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58 md4_get_digest(wpwd, len, hash);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60 safe_memset(wpwd, 0, len);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
61 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63 static void
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
64 hmac_md5_ucs2le_string_ucase(struct hmac_context *ctx, const char *str)
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 {
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66 size_t len;
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 unsigned char *wstr = t_unicode_str(str, 1, &len);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
69 hmac_update(ctx, wstr, len);
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71
14629
c93ca5e46a8a Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
Timo Sirainen <tss@iki.fi>
parents: 6414
diff changeset
72 static void ATTR_NULL(2)
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 ntlm_v2_hash(const char *user, const char *target,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74 const unsigned char *hash_v1,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 unsigned char hash[NTLMSSP_V2_HASH_SIZE])
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
76 {
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
77 struct hmac_context ctx;
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
79 hmac_init(&ctx, hash_v1, NTLMSSP_HASH_SIZE, &hash_method_md5);
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 hmac_md5_ucs2le_string_ucase(&ctx, user);
14629
c93ca5e46a8a Marked functions parameters that are allowed to be NULL. Some APIs were also changed.
Timo Sirainen <tss@iki.fi>
parents: 6414
diff changeset
81 if (target != NULL)
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 hmac_md5_ucs2le_string_ucase(&ctx, target);
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
83 hmac_final(&ctx, hash);
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86 void
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87 ntlmssp_v1_response(const unsigned char *hash,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
88 const unsigned char *challenge,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89 unsigned char response[NTLMSSP_RESPONSE_SIZE])
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
90 {
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91 unsigned char des_hash[NTLMSSP_DES_KEY_LENGTH * 3];
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 memcpy(des_hash, hash, NTLMSSP_HASH_SIZE);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94 memset(des_hash + NTLMSSP_HASH_SIZE, 0,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95 sizeof(des_hash) - NTLMSSP_HASH_SIZE);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96
2523
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
97 deshash(response, des_hash, challenge);
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
98 deshash(response + 8, des_hash + 7, challenge);
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
99 deshash(response + 16, des_hash + 14, challenge);
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
100
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
101 safe_memset(des_hash, 0, sizeof(des_hash));
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102 }
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
103
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
104 void
2692
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
105 ntlmssp2_response(const unsigned char *hash,
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
106 const unsigned char *server_challenge,
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
107 const unsigned char *client_challenge,
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
108 unsigned char response[NTLMSSP_RESPONSE_SIZE])
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
109 {
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
110 struct md5_context ctx;
5609
6f924ecdc154 cleanup
Timo Sirainen <tss@iki.fi>
parents: 4382
diff changeset
111 unsigned char session_hash[MD5_RESULTLEN];
2692
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
112
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
113 md5_init(&ctx);
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
114 md5_update(&ctx, server_challenge, NTLMSSP_CHALLENGE_SIZE);
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
115 md5_update(&ctx, client_challenge, NTLMSSP_CHALLENGE_SIZE);
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
116 md5_final(&ctx, session_hash);
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
117
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
118 ntlmssp_v1_response(hash, session_hash, response);
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
119 }
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
120
1065a557516b NTLM2 authentication support. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents: 2654
diff changeset
121 void
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 ntlmssp_v2_response(const char *user, const char *target,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123 const unsigned char *hash_v1,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124 const unsigned char *challenge,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125 const unsigned char *blob, size_t blob_size,
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
126 unsigned char response[NTLMSSP_V2_RESPONSE_SIZE])
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
127 {
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
128 struct hmac_context ctx;
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
129 unsigned char hash[NTLMSSP_V2_HASH_SIZE];
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
130
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
131 ntlm_v2_hash(user, target, hash_v1, hash);
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
132
15172
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
133 hmac_init(&ctx, hash, NTLMSSP_V2_HASH_SIZE, &hash_method_md5);
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
134 hmac_update(&ctx, challenge, NTLMSSP_CHALLENGE_SIZE);
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
135 hmac_update(&ctx, blob, blob_size);
8802322d7257 lib: Generalize hmac to be hash independent
Florian Zeitz <florob@babelmonkeys.de>
parents: 14682
diff changeset
136 hmac_final(&ctx, response);
2523
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
137
415b3e8dea35 Patch by Andrey Panin:
Timo Sirainen <tss@iki.fi>
parents: 2387
diff changeset
138 safe_memset(hash, 0, sizeof(hash));
2377
8f5be0be3199 NTLM authentication. Patch by Andrey Panin
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
139 }