aboutsummaryrefslogtreecommitdiff
path: root/lib/vauth/ntlm.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-11-11 14:53:36 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-11-14 08:23:52 +0100
commitf682156a4fc6c43fb38db4abda49b9a1bc1ed368 (patch)
tree32b49aeaefc66c54426f8e7e5e9c2d9aced6147d /lib/vauth/ntlm.c
parent050aa803096f6d745a173d5810c65dd829f2f8b2 (diff)
Curl_rand: fixed and moved to rand.c
Now Curl_rand() is made to fail if it cannot get the necessary random level. Changed the proto of Curl_rand() slightly to provide a number of ints at once. Moved out from vtls, since it isn't a TLS function and vtls provides Curl_ssl_random() for this to use. Discussion: https://curl.haxx.se/mail/lib-2016-11/0119.html
Diffstat (limited to 'lib/vauth/ntlm.c')
-rw-r--r--lib/vauth/ntlm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/vauth/ntlm.c b/lib/vauth/ntlm.c
index b484a011a..b4d345d63 100644
--- a/lib/vauth/ntlm.c
+++ b/lib/vauth/ntlm.c
@@ -41,7 +41,7 @@
#include "curl_gethostname.h"
#include "curl_multibyte.h"
#include "warnless.h"
-
+#include "rand.h"
#include "vtls/vtls.h"
#ifdef USE_NSS
@@ -558,8 +558,9 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
unsigned int entropy[2];
unsigned char ntlmv2hash[0x18];
- entropy[0] = Curl_rand(data);
- entropy[1] = Curl_rand(data);
+ result = Curl_rand(data, &entropy[0], 2);
+ if(result)
+ return result;
result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer);
if(result)
@@ -598,8 +599,9 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
unsigned int entropy[2];
/* Need to create 8 bytes random data */
- entropy[0] = Curl_rand(data);
- entropy[1] = Curl_rand(data);
+ result = Curl_rand(data, &entropy[0], 2);
+ if(result)
+ return result;
/* 8 bytes random data as challenge in lmresp */
memcpy(lmresp, entropy, 8);