Skip to content

Commit c4b423f

Browse files
authored
Merge pull request #660 from levitte/no-BCryptGenRandom
Make the definition of LTC_WIN32_BCRYPT private
2 parents 427ce33 + 00708c8 commit c4b423f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/headers/tomcrypt_cfg.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,6 @@ typedef unsigned long ltc_mp_digit;
312312
# endif
313313
#endif
314314

315-
#if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && !defined(LTC_WIN32_BCRYPT)
316-
# define LTC_WIN32_BCRYPT
317-
#endif
318-
319315
/* Define `LTC_NO_NULL_TERMINATION_CHECK` in the user code
320316
* before including `tomcrypt.h` to disable this functionality.
321317
*/

src/headers/tomcrypt_private.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,3 +682,14 @@ int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng
682682
#else
683683
#define LTC_BYTE(x, n) (((x) >> (8 * (n))) & 255)
684684
#endif
685+
686+
/*
687+
* On Windows, choose whether to use CryptGenRandom() [older Windows versions]
688+
* or BCryptGenRandom() [newer Windows versions].
689+
* If CryptGenRandom() is desired, define LTC_NO_WIN32_BCRYPT when building.
690+
*/
691+
#if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
692+
#if !defined(LTC_NO_WIN32_BCRYPT)
693+
#define LTC_WIN32_BCRYPT
694+
#endif
695+
#endif

0 commit comments

Comments
 (0)