unit1600.c (2654B)
1 /*************************************************************************** 2 * _ _ ____ _ 3 * Project ___| | | | _ \| | 4 * / __| | | | |_) | | 5 * | (__| |_| | _ <| |___ 6 * \___|\___/|_| \_\_____| 7 * 8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 9 * 10 * This software is licensed as described in the file COPYING, which 11 * you should have received as part of this distribution. The terms 12 * are also available at https://curl.se/docs/copyright.html. 13 * 14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 15 * copies of the Software, and permit persons to whom the Software is 16 * furnished to do so, under the terms of the COPYING file. 17 * 18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 19 * KIND, either express or implied. 20 * 21 * SPDX-License-Identifier: curl 22 * 23 ***************************************************************************/ 24 #include "unitcheck.h" 25 26 #include "urldata.h" 27 #include "curl_ntlm_core.h" 28 29 static CURLcode t1600_setup(CURL **easy) 30 { 31 CURLcode res = CURLE_OK; 32 33 global_init(CURL_GLOBAL_ALL); 34 *easy = curl_easy_init(); 35 if(!*easy) { 36 curl_global_cleanup(); 37 return CURLE_OUT_OF_MEMORY; 38 } 39 return res; 40 } 41 42 static void t1600_stop(CURL *easy) 43 { 44 curl_easy_cleanup(easy); 45 curl_global_cleanup(); 46 } 47 48 static CURLcode test_unit1600(char *arg) 49 { 50 CURL *easy; 51 52 UNITTEST_BEGIN(t1600_setup(&easy)) 53 54 #if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || \ 55 defined(USE_WIN32_CRYPTO)) 56 unsigned char output[21]; 57 unsigned char *testp = output; 58 Curl_ntlm_core_mk_nt_hash("1", output); 59 60 verify_memory(testp, 61 "\x69\x94\x3c\x5e\x63\xb4\xd2\xc1\x04\xdb" 62 "\xbc\xc1\x51\x38\xb7\x2b\x00\x00\x00\x00\x00", 21); 63 64 Curl_ntlm_core_mk_nt_hash("hello-you-fool", output); 65 66 verify_memory(testp, 67 "\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0" 68 "\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21); 69 70 /* !checksrc! disable LONGLINE 2 */ 71 Curl_ntlm_core_mk_nt_hash("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output); 72 73 verify_memory(testp, 74 "\x36\x9d\xae\x06\x84\x7e\xe1\xc1\x4a\x94\x39\xea\x6f\x44\x8c\x65\x00\x00\x00\x00\x00", 21); 75 #endif 76 77 UNITTEST_END(t1600_stop(easy)) 78 }