Skip to content

Commit 6c70f24

Browse files
committed
Update ntlmclient dependency
1 parent 3594a54 commit 6c70f24

File tree

7 files changed

+53
-31
lines changed

7 files changed

+53
-31
lines changed

deps/ntlmclient/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ else()
3737
endif()
3838

3939
add_library(ntlmclient OBJECT ${SRC_NTLMCLIENT} ${SRC_NTLMCLIENT_UNICODE} ${SRC_NTLMCLIENT_CRYPTO})
40+
set_target_properties(ntlmclient PROPERTIES C_STANDARD 90)

deps/ntlmclient/crypt_openssl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,18 @@
2626

2727
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(CRYPT_OPENSSL_DYNAMIC)
2828

29-
static inline HMAC_CTX *HMAC_CTX_new(void)
29+
NTLM_INLINE(HMAC_CTX *) HMAC_CTX_new(void)
3030
{
3131
return calloc(1, sizeof(HMAC_CTX));
3232
}
3333

34-
static inline int HMAC_CTX_reset(HMAC_CTX *ctx)
34+
NTLM_INLINE(int) HMAC_CTX_reset(HMAC_CTX *ctx)
3535
{
3636
ntlm_memzero(ctx, sizeof(HMAC_CTX));
3737
return 1;
3838
}
3939

40-
static inline void HMAC_CTX_free(HMAC_CTX *ctx)
40+
NTLM_INLINE(void) HMAC_CTX_free(HMAC_CTX *ctx)
4141
{
4242
free(ctx);
4343
}
@@ -48,7 +48,7 @@ static inline void HMAC_CTX_free(HMAC_CTX *ctx)
4848
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x03050000fL) || \
4949
defined(CRYPT_OPENSSL_DYNAMIC)
5050

51-
static inline void HMAC_CTX_cleanup(HMAC_CTX *ctx)
51+
NTLM_INLINE(void) HMAC_CTX_cleanup(HMAC_CTX *ctx)
5252
{
5353
NTLM_UNUSED(ctx);
5454
}

deps/ntlmclient/ntlm.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static bool supports_unicode(ntlm_client *ntlm)
4343
false : true;
4444
}
4545

46-
static inline bool increment_size(size_t *out, size_t incr)
46+
NTLM_INLINE(bool) increment_size(size_t *out, size_t incr)
4747
{
4848
if (SIZE_MAX - *out < incr) {
4949
*out = (size_t)-1;
@@ -272,7 +272,7 @@ int ntlm_client_set_timestamp(ntlm_client *ntlm, uint64_t timestamp)
272272
return 0;
273273
}
274274

275-
static inline bool write_buf(
275+
NTLM_INLINE(bool) write_buf(
276276
ntlm_client *ntlm,
277277
ntlm_buf *out,
278278
const unsigned char *buf,
@@ -291,7 +291,7 @@ static inline bool write_buf(
291291
return true;
292292
}
293293

294-
static inline bool write_byte(
294+
NTLM_INLINE(bool) write_byte(
295295
ntlm_client *ntlm,
296296
ntlm_buf *out,
297297
uint8_t value)
@@ -305,7 +305,7 @@ static inline bool write_byte(
305305
return true;
306306
}
307307

308-
static inline bool write_int16(
308+
NTLM_INLINE(bool) write_int16(
309309
ntlm_client *ntlm,
310310
ntlm_buf *out,
311311
uint16_t value)
@@ -320,7 +320,7 @@ static inline bool write_int16(
320320
return true;
321321
}
322322

323-
static inline bool write_int32(
323+
NTLM_INLINE(bool) write_int32(
324324
ntlm_client *ntlm,
325325
ntlm_buf *out,
326326
uint32_t value)
@@ -337,7 +337,7 @@ static inline bool write_int32(
337337
return true;
338338
}
339339

340-
static inline bool write_version(
340+
NTLM_INLINE(bool) write_version(
341341
ntlm_client *ntlm,
342342
ntlm_buf *out,
343343
ntlm_version *version)
@@ -348,7 +348,7 @@ static inline bool write_version(
348348
write_int32(ntlm, out, version->reserved);
349349
}
350350

351-
static inline bool write_bufinfo(
351+
NTLM_INLINE(bool) write_bufinfo(
352352
ntlm_client *ntlm,
353353
ntlm_buf *out,
354354
size_t len,
@@ -369,7 +369,7 @@ static inline bool write_bufinfo(
369369
write_int32(ntlm, out, (uint32_t)offset);
370370
}
371371

372-
static inline bool read_buf(
372+
NTLM_INLINE(bool) read_buf(
373373
unsigned char *out,
374374
ntlm_client *ntlm,
375375
ntlm_buf *message,
@@ -386,7 +386,7 @@ static inline bool read_buf(
386386
return true;
387387
}
388388

389-
static inline bool read_byte(
389+
NTLM_INLINE(bool) read_byte(
390390
uint8_t *out,
391391
ntlm_client *ntlm,
392392
ntlm_buf *message)
@@ -400,7 +400,7 @@ static inline bool read_byte(
400400
return true;
401401
}
402402

403-
static inline bool read_int16(
403+
NTLM_INLINE(bool) read_int16(
404404
uint16_t *out,
405405
ntlm_client *ntlm,
406406
ntlm_buf *message)
@@ -418,7 +418,7 @@ static inline bool read_int16(
418418
return true;
419419
}
420420

421-
static inline bool read_int32(
421+
NTLM_INLINE(bool) read_int32(
422422
uint32_t *out,
423423
ntlm_client *ntlm,
424424
ntlm_buf *message)
@@ -438,7 +438,7 @@ static inline bool read_int32(
438438
return true;
439439
}
440440

441-
static inline bool read_int64(
441+
NTLM_INLINE(bool) read_int64(
442442
uint64_t *out,
443443
ntlm_client *ntlm,
444444
ntlm_buf *message)
@@ -462,7 +462,7 @@ static inline bool read_int64(
462462
return true;
463463
}
464464

465-
static inline bool read_version(
465+
NTLM_INLINE(bool) read_version(
466466
ntlm_version *out,
467467
ntlm_client *ntlm,
468468
ntlm_buf *message)
@@ -473,7 +473,7 @@ static inline bool read_version(
473473
read_int32(&out->reserved, ntlm, message);
474474
}
475475

476-
static inline bool read_bufinfo(
476+
NTLM_INLINE(bool) read_bufinfo(
477477
uint16_t *out_len,
478478
uint32_t *out_offset,
479479
ntlm_client *ntlm,
@@ -486,7 +486,7 @@ static inline bool read_bufinfo(
486486
read_int32(out_offset, ntlm, message);
487487
}
488488

489-
static inline bool read_string_unicode(
489+
NTLM_INLINE(bool) read_string_unicode(
490490
char **out,
491491
ntlm_client *ntlm,
492492
ntlm_buf *message,
@@ -504,7 +504,7 @@ static inline bool read_string_unicode(
504504
return ret;
505505
}
506506

507-
static inline bool read_string_ascii(
507+
NTLM_INLINE(bool) read_string_ascii(
508508
char **out,
509509
ntlm_client *ntlm,
510510
ntlm_buf *message,
@@ -526,7 +526,7 @@ static inline bool read_string_ascii(
526526
return true;
527527
}
528528

529-
static inline bool read_string(
529+
NTLM_INLINE(bool) read_string(
530530
char **out,
531531
ntlm_client *ntlm,
532532
ntlm_buf *message,
@@ -539,7 +539,7 @@ static inline bool read_string(
539539
return read_string_ascii(out, ntlm, message, string_len);
540540
}
541541

542-
static inline bool read_target_info(
542+
NTLM_INLINE(bool) read_target_info(
543543
char **server_out,
544544
char **domain_out,
545545
char **server_dns_out,
@@ -965,7 +965,7 @@ static void des_key_from_password(
965965
generate_odd_parity(out);
966966
}
967967

968-
static inline bool generate_lm_hash(
968+
NTLM_INLINE(bool) generate_lm_hash(
969969
ntlm_des_block out[2],
970970
ntlm_client *ntlm,
971971
const char *password)

deps/ntlmclient/unicode_builtin.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "ntlm.h"
1313
#include "unicode.h"
1414
#include "compat.h"
15+
#include "util.h"
1516

1617
typedef unsigned int UTF32; /* at least 32 bits */
1718
typedef unsigned short UTF16; /* at least 16 bits */
@@ -180,7 +181,7 @@ static ConversionResult ConvertUTF16toUTF8 (
180181
* definition of UTF-8 goes up to 4-byte sequences.
181182
*/
182183

183-
static inline bool isLegalUTF8(const UTF8 *source, int length) {
184+
NTLM_INLINE(bool) isLegalUTF8(const UTF8 *source, int length) {
184185
UTF8 a;
185186
const UTF8 *srcptr = source+length;
186187
switch (length) {
@@ -288,7 +289,7 @@ typedef enum {
288289
unicode_builtin_utf16_to_8
289290
} unicode_builtin_encoding_direction;
290291

291-
static inline bool unicode_builtin_encoding_convert(
292+
NTLM_INLINE(bool) unicode_builtin_encoding_convert(
292293
char **converted,
293294
size_t *converted_len,
294295
ntlm_client *ntlm,

deps/ntlmclient/unicode_iconv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "ntlmclient.h"
1515
#include "unicode.h"
1616
#include "ntlm.h"
17+
#include "util.h"
1718
#include "compat.h"
1819

1920
typedef enum {
@@ -40,7 +41,7 @@ bool ntlm_unicode_init(ntlm_client *ntlm)
4041
return true;
4142
}
4243

43-
static inline bool unicode_iconv_encoding_convert(
44+
NTLM_INLINE(bool) unicode_iconv_encoding_convert(
4445
char **converted,
4546
size_t *converted_len,
4647
ntlm_client *ntlm,

deps/ntlmclient/utf8.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
#pragma warning(disable : 4820)
4444
#endif
4545

46+
#if defined(__cplusplus)
47+
#if defined(_MSC_VER)
48+
#define utf8_cplusplus _MSVC_LANG
49+
#else
50+
#define utf8_cplusplus __cplusplus
51+
#endif
52+
#endif
53+
4654
#include <stddef.h>
4755
#include <stdlib.h>
4856

@@ -67,7 +75,7 @@ typedef int32_t utf8_int32_t;
6775
#endif
6876
#endif
6977

70-
#ifdef __cplusplus
78+
#ifdef utf8_cplusplus
7179
extern "C" {
7280
#endif
7381

@@ -96,13 +104,13 @@ extern "C" {
96104
#error Non clang, non gcc, non MSVC, non tcc compiler found!
97105
#endif
98106

99-
#ifdef __cplusplus
107+
#ifdef utf8_cplusplus
100108
#define utf8_null NULL
101109
#else
102110
#define utf8_null 0
103111
#endif
104112

105-
#if (defined(__cplusplus) && __cplusplus >= 201402L)
113+
#if defined(utf8_cplusplus) && utf8_cplusplus >= 201402L && (!defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER >= 1910))
106114
#define utf8_constexpr14 constexpr
107115
#define utf8_constexpr14_impl constexpr
108116
#else
@@ -111,7 +119,7 @@ extern "C" {
111119
#define utf8_constexpr14_impl
112120
#endif
113121

114-
#if defined(__cplusplus) && __cplusplus >= 202002L
122+
#if defined(utf8_cplusplus) && utf8_cplusplus >= 202002L
115123
using utf8_int8_t = char8_t; /* Introduced in C++20 */
116124
#else
117125
typedef char utf8_int8_t;
@@ -1693,7 +1701,7 @@ utf8rcodepoint(const utf8_int8_t *utf8_restrict str,
16931701
#undef utf8_constexpr14
16941702
#undef utf8_null
16951703

1696-
#ifdef __cplusplus
1704+
#ifdef utf8_cplusplus
16971705
} /* extern "C" */
16981706
#endif
16991707

deps/ntlmclient/util.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
#ifndef PRIVATE_UTIL_H__
1010
#define PRIVATE_UTIL_H__
1111

12+
#include <stddef.h>
13+
#include <stdint.h>
14+
15+
#if defined(_MSC_VER)
16+
# define NTLM_INLINE(type) static __inline type
17+
#elif defined(__GNUC__)
18+
# define NTLM_INLINE(type) static __inline__ type
19+
#else
20+
# define NTLM_INLINE(type) static type
21+
#endif
22+
1223
extern void ntlm_memzero(void *data, size_t size);
1324
extern uint64_t ntlm_htonll(uint64_t value);
1425

0 commit comments

Comments
 (0)