]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl_ntlm_core: propagate DES `CryptEncrypt()` error
authorViktor Szakats <commit@vsz.me>
Tue, 12 May 2026 13:56:11 +0000 (15:56 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 12 May 2026 15:14:38 +0000 (17:14 +0200)
Spotted by GitHub Code Quality

Closes #21569

lib/curl_ntlm_core.c

index e6aab7e39e96945df2d4096f728df255b88a98bb..9f8db0328fd721519ecf1fd69d8490a71e3d7544 100644 (file)
@@ -251,6 +251,7 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
     char key[8];
   } blob;
   DWORD len = 8;
+  BOOL res;
 
   /* Acquire the crypto provider */
   if(!CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_FULL,
@@ -280,12 +281,12 @@ static bool encrypt_des(const unsigned char *in, unsigned char *out,
   memcpy(out, in, 8);
 
   /* Perform the encryption */
-  CryptEncrypt(hkey, 0, FALSE, 0, out, &len, len);
+  res = CryptEncrypt(hkey, 0, FALSE, 0, out, &len, len);
 
   CryptDestroyKey(hkey);
   CryptReleaseContext(hprov, 0);
 
-  return TRUE;
+  return res;
 }
 
 #endif /* crypto backends */