1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
6 * This file provides the necessary methods for authenticating with
7 * Microsoft's Secure Password Authentication.
9 * All the code used here was torn by Marc Prud'hommeaux out of the
10 * Samba project (by Andrew Tridgell, Jeremy Allison, and others).
12 /* SPDX-License-Identifier: GPL-2.0-or-later */
14 /* December 2004: The spa_base64_to_bits() function has no length checking in
15 it. I have added a check. PH */
17 /* It seems that some systems have existing but different definitions of some
18 of the following types. I received a complaint about "int16" causing
19 compilation problems. So I (PH) have renamed them all, to be on the safe side.
21 typedef signed short int16;
22 typedef unsigned short uint16;
23 typedef unsigned uint32;
24 typedef unsigned char uint8;
27 typedef signed short int16x;
28 typedef unsigned short uint16x;
29 typedef unsigned uint32x;
30 typedef unsigned char uint8x;
45 uint8x challengeData[8];
47 SPAStrHeader emptyString;
68 SPAStrHeader lmResponse;
69 SPAStrHeader ntResponse;
73 SPAStrHeader sessionKey;
79 #define spa_request_length(ptr) (((ptr)->buffer - (uint8x*)(ptr)) + (ptr)->bufIndex)
81 void spa_bits_to_base64 (unsigned char *, const unsigned char *, int);
82 int spa_base64_to_bits(char *, int, const char *);
83 void spa_build_auth_response (SPAAuthChallenge * challenge,
84 SPAAuthResponse * response, uschar * user, uschar * password);
85 void spa_build_auth_request (SPAAuthRequest * request, uschar * user,
87 extern void spa_smb_encrypt (unsigned char * passwd, unsigned char * c8,
89 extern void spa_smb_nt_encrypt (unsigned char * passwd, unsigned char * c8,
91 extern char *unicodeToString(char *p, size_t len);
92 extern void spa_build_auth_challenge(SPAAuthRequest *, SPAAuthChallenge *);