1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6   @file crypt.c
7   Build strings, Tom St Denis
8 */
9 #define NAME_VALUE(s) #s"="NAME(s)
10 #define NAME(s) #s
11 
12 const char *crypt_build_settings =
13    "LibTomCrypt " SCRYPT " (www.libtom.net)\n"
14    "LibTomCrypt is public domain software.\n"
15 #if defined(INCLUDE_BUILD_DATE)
16    "Built on " __DATE__ " at " __TIME__ "\n"
17 #endif
18    "\n\nEndianness: "
19 #if defined(ENDIAN_NEUTRAL)
20    "neutral/"
21 #endif
22 #if defined(ENDIAN_LITTLE)
23    "little"
24 #elif defined(ENDIAN_BIG)
25    "big"
26 #endif
27    #if defined(ENDIAN_32BITWORD)
28    " (32-bit words)\n"
29    #elif defined(ENDIAN_64BITWORD)
30    " (64-bit words)\n"
31    #else
32    " (no wordsize defined)\n"
33    #endif
34    "Clean stack: "
35 #if defined(LTC_CLEAN_STACK)
36    "enabled\n"
37 #else
38    "disabled\n"
39 #endif
40    "\nCiphers built-in:\n"
41 #if defined(LTC_BLOWFISH)
42    "   Blowfish\n"
43 #endif
44 #if defined(LTC_RC2)
45    "   RC2\n"
46 #endif
47 #if defined(LTC_RC5)
48    "   RC5\n"
49 #endif
50 #if defined(LTC_RC6)
51    "   RC6\n"
52 #endif
53 #if defined(LTC_SAFERP)
54    "   Safer+\n"
55 #endif
56 #if defined(LTC_SAFER)
57    "   Safer\n"
58 #endif
59 #if defined(LTC_RIJNDAEL)
60    "   Rijndael\n"
61 #endif
62 #if defined(LTC_XTEA)
63    "   XTEA\n"
64 #endif
65 #if defined(LTC_TWOFISH)
66    "   Twofish "
67    #if defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES)
68        "(small, tables, all_tables)\n"
69    #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_TABLES)
70        "(small, tables)\n"
71    #elif defined(LTC_TWOFISH_SMALL) && defined(LTC_TWOFISH_ALL_TABLES)
72        "(small, all_tables)\n"
73    #elif defined(LTC_TWOFISH_TABLES) && defined(LTC_TWOFISH_ALL_TABLES)
74        "(tables, all_tables)\n"
75    #elif defined(LTC_TWOFISH_SMALL)
76        "(small)\n"
77    #elif defined(LTC_TWOFISH_TABLES)
78        "(tables)\n"
79    #elif defined(LTC_TWOFISH_ALL_TABLES)
80        "(all_tables)\n"
81    #else
82        "\n"
83    #endif
84 #endif
85 #if defined(LTC_DES)
86    "   DES\n"
87 #endif
88 #if defined(LTC_CAST5)
89    "   CAST5\n"
90 #endif
91 #if defined(LTC_NOEKEON)
92    "   Noekeon\n"
93 #endif
94 #if defined(LTC_SKIPJACK)
95    "   Skipjack\n"
96 #endif
97 #if defined(LTC_KHAZAD)
98    "   Khazad\n"
99 #endif
100 #if defined(LTC_ANUBIS)
101    "   Anubis "
102 #endif
103 #if defined(LTC_ANUBIS_TWEAK)
104    " (tweaked)"
105 #endif
106    "\n"
107 #if defined(LTC_KSEED)
108    "   KSEED\n"
109 #endif
110 #if defined(LTC_KASUMI)
111    "   KASUMI\n"
112 #endif
113 #if defined(LTC_MULTI2)
114    "   MULTI2\n"
115 #endif
116 #if defined(LTC_CAMELLIA)
117    "   Camellia\n"
118 #endif
119 #if defined(LTC_IDEA)
120    "   IDEA\n"
121 #endif
122 #if defined(LTC_SERPENT)
123    "   Serpent\n"
124 #endif
125 #if defined(LTC_TEA)
126    "   TEA\n"
127 #endif
128    "Stream ciphers built-in:\n"
129 #if defined(LTC_CHACHA)
130    "   ChaCha\n"
131 #endif
132 #if defined(LTC_SALSA20)
133    "   Salsa20\n"
134 #endif
135 #if defined(LTC_XSALSA20)
136    "   XSalsa20\n"
137 #endif
138 #if defined(LTC_SOSEMANUK)
139    "   Sosemanuk\n"
140 #endif
141 #if defined(LTC_RABBIT)
142    "   Rabbit\n"
143 #endif
144 #if defined(LTC_RC4_STREAM)
145    "   RC4\n"
146 #endif
147 #if defined(LTC_SOBER128_STREAM)
148    "   SOBER128\n"
149 #endif
150 
151     "\nHashes built-in:\n"
152 #if defined(LTC_SHA3)
153    "   SHA3\n"
154 #endif
155 #if defined(LTC_KECCAK)
156    "   KECCAK\n"
157 #endif
158 #if defined(LTC_SHA512)
159    "   SHA-512\n"
160 #endif
161 #if defined(LTC_SHA384)
162    "   SHA-384\n"
163 #endif
164 #if defined(LTC_SHA512_256)
165    "   SHA-512/256\n"
166 #endif
167 #if defined(LTC_SHA256)
168    "   SHA-256\n"
169 #endif
170 #if defined(LTC_SHA512_224)
171    "   SHA-512/224\n"
172 #endif
173 #if defined(LTC_SHA224)
174    "   SHA-224\n"
175 #endif
176 #if defined(LTC_TIGER)
177    "   TIGER\n"
178 #endif
179 #if defined(LTC_SHA1)
180    "   SHA1\n"
181 #endif
182 #if defined(LTC_MD5)
183    "   MD5\n"
184 #endif
185 #if defined(LTC_MD4)
186    "   MD4\n"
187 #endif
188 #if defined(LTC_MD2)
189    "   MD2\n"
190 #endif
191 #if defined(LTC_RIPEMD128)
192    "   RIPEMD128\n"
193 #endif
194 #if defined(LTC_RIPEMD160)
195    "   RIPEMD160\n"
196 #endif
197 #if defined(LTC_RIPEMD256)
198    "   RIPEMD256\n"
199 #endif
200 #if defined(LTC_RIPEMD320)
201    "   RIPEMD320\n"
202 #endif
203 #if defined(LTC_WHIRLPOOL)
204    "   WHIRLPOOL\n"
205 #endif
206 #if defined(LTC_BLAKE2S)
207    "   BLAKE2S\n"
208 #endif
209 #if defined(LTC_BLAKE2B)
210    "   BLAKE2B\n"
211 #endif
212 #if defined(LTC_CHC_HASH)
213    "   CHC_HASH\n"
214 #endif
215 
216     "\nBlock Chaining Modes:\n"
217 #if defined(LTC_CFB_MODE)
218     "   CFB\n"
219 #endif
220 #if defined(LTC_OFB_MODE)
221     "   OFB\n"
222 #endif
223 #if defined(LTC_ECB_MODE)
224     "   ECB\n"
225 #endif
226 #if defined(LTC_CBC_MODE)
227     "   CBC\n"
228 #endif
229 #if defined(LTC_CTR_MODE)
230     "   CTR\n"
231 #endif
232 #if defined(LTC_LRW_MODE)
233     "   LRW"
234 #if defined(LTC_LRW_TABLES)
235     " (tables) "
236 #endif
237     "\n"
238 #endif
239 #if defined(LTC_F8_MODE)
240     "   F8\n"
241 #endif
242 #if defined(LTC_XTS_MODE)
243     "   XTS\n"
244 #endif
245 
246     "\nMACs:\n"
247 #if defined(LTC_HMAC)
248     "   HMAC\n"
249 #endif
250 #if defined(LTC_OMAC)
251     "   OMAC\n"
252 #endif
253 #if defined(LTC_PMAC)
254     "   PMAC\n"
255 #endif
256 #if defined(LTC_PELICAN)
257     "   PELICAN\n"
258 #endif
259 #if defined(LTC_XCBC)
260     "   XCBC\n"
261 #endif
262 #if defined(LTC_F9_MODE)
263     "   F9\n"
264 #endif
265 #if defined(LTC_POLY1305)
266     "   POLY1305\n"
267 #endif
268 #if defined(LTC_BLAKE2SMAC)
269     "   BLAKE2S MAC\n"
270 #endif
271 #if defined(LTC_BLAKE2BMAC)
272     "   BLAKE2B MAC\n"
273 #endif
274 
275     "\nENC + AUTH modes:\n"
276 #if defined(LTC_EAX_MODE)
277     "   EAX\n"
278 #endif
279 #if defined(LTC_OCB_MODE)
280     "   OCB\n"
281 #endif
282 #if defined(LTC_OCB3_MODE)
283     "   OCB3\n"
284 #endif
285 #if defined(LTC_CCM_MODE)
286     "   CCM\n"
287 #endif
288 #if defined(LTC_GCM_MODE)
289     "   GCM"
290 #if defined(LTC_GCM_TABLES)
291     " (tables) "
292 #endif
293 #if defined(LTC_GCM_TABLES_SSE2)
294     " (SSE2) "
295 #endif
296    "\n"
297 #endif
298 #if defined(LTC_CHACHA20POLY1305_MODE)
299     "   CHACHA20POLY1305\n"
300 #endif
301 
302     "\nPRNG:\n"
303 #if defined(LTC_YARROW)
304     "   Yarrow ("NAME_VALUE(LTC_YARROW_AES)")\n"
305 #endif
306 #if defined(LTC_SPRNG)
307     "   SPRNG\n"
308 #endif
309 #if defined(LTC_RC4)
310     "   RC4\n"
311 #endif
312 #if defined(LTC_CHACHA20_PRNG)
313     "   ChaCha20\n"
314 #endif
315 #if defined(LTC_FORTUNA)
316     "   Fortuna (" NAME_VALUE(LTC_FORTUNA_POOLS) ", "
317 #if defined(LTC_FORTUNA_RESEED_RATELIMIT_TIMED)
318     "LTC_FORTUNA_RESEED_RATELIMIT_TIMED, "
319 #else
320     "LTC_FORTUNA_RESEED_RATELIMIT_STATIC, " NAME_VALUE(LTC_FORTUNA_WD)
321 #endif
322     ")\n"
323 #endif
324 #if defined(LTC_SOBER128)
325     "   SOBER128\n"
326 #endif
327 
328     "\nPK Crypto:\n"
329 #if defined(LTC_MRSA)
330     "   RSA"
331 #if defined(LTC_RSA_BLINDING) && defined(LTC_RSA_CRT_HARDENING)
332     " (with blinding and CRT hardening)"
333 #elif defined(LTC_RSA_BLINDING)
334     " (with blinding)"
335 #elif defined(LTC_RSA_CRT_HARDENING)
336     " (with CRT hardening)"
337 #endif
338     "\n"
339 #endif
340 #if defined(LTC_MDH)
341     "   DH\n"
342 #endif
343 #if defined(LTC_MECC)
344     "   ECC"
345 #if defined(LTC_ECC_TIMING_RESISTANT)
346     " (with blinding)"
347 #endif
348     "\n"
349 #endif
350 #if defined(LTC_MDSA)
351     "   DSA\n"
352 #endif
353 #if defined(LTC_CURVE25519)
354 #if defined(LTC_CURVE25519)
355     "   Ed25519\n"
356 #endif
357 #if defined(LTC_CURVE25519)
358     "   X25519\n"
359 #endif
360 #endif
361 #if defined(LTC_PK_MAX_RETRIES)
362     "   "NAME_VALUE(LTC_PK_MAX_RETRIES)"\n"
363 #endif
364 
365     "\nMPI (Math):\n"
366 #if defined(LTC_MPI)
367     "   LTC_MPI\n"
368 #endif
369 #if defined(LTM_DESC)
370     "   LTM_DESC\n"
371 #endif
372 #if defined(TFM_DESC)
373     "   TFM_DESC\n"
374 #endif
375 #if defined(GMP_DESC)
376     "   GMP_DESC\n"
377 #endif
378 #if defined(LTC_MILLER_RABIN_REPS)
379     "   "NAME_VALUE(LTC_MILLER_RABIN_REPS)"\n"
380 #endif
381 
382     "\nCompiler:\n"
383 #if defined(_WIN64)
384     "   WIN64 platform detected.\n"
385 #elif defined(_WIN32)
386     "   WIN32 platform detected.\n"
387 #endif
388 #if defined(__CYGWIN__)
389     "   CYGWIN Detected.\n"
390 #endif
391 #if defined(__DJGPP__)
392     "   DJGPP Detected.\n"
393 #endif
394 #if defined(_MSC_VER)
395     "   MSVC compiler detected.\n"
396 #endif
397 #if defined(__clang_version__)
398     "   Clang compiler " __clang_version__ ".\n"
399 #elif defined(INTEL_CC)
400     "   Intel C Compiler " __VERSION__ ".\n"
401 #elif defined(__GNUC__)         /* clang and icc also define __GNUC__ */
402     "   GCC compiler " __VERSION__ ".\n"
403 #endif
404 
405 #if defined(__x86_64__)
406     "   x86-64 detected.\n"
407 #endif
408 #if defined(LTC_PPC32)
409     "   PPC32 detected.\n"
410 #endif
411 
412     "\nVarious others: "
413 #if defined(ARGTYPE)
414     " " NAME_VALUE(ARGTYPE) " "
415 #endif
416 #if defined(LTC_ADLER32)
417     " ADLER32 "
418 #endif
419 #if defined(LTC_BASE64)
420     " BASE64 "
421 #endif
422 #if defined(LTC_BASE64_URL)
423     " BASE64-URL-SAFE "
424 #endif
425 #if defined(LTC_BASE32)
426     " BASE32 "
427 #endif
428 #if defined(LTC_BASE16)
429     " BASE16 "
430 #endif
431 #if defined(LTC_BCRYPT)
432     " BCRYPT "
433     " " NAME_VALUE(LTC_BCRYPT_DEFAULT_ROUNDS) " "
434 #endif
435 #if defined(LTC_CRC32)
436     " CRC32 "
437 #endif
438 #if defined(LTC_DER)
439     " DER "
440     " " NAME_VALUE(LTC_DER_MAX_RECURSION) " "
441 #endif
442 #if defined(LTC_PKCS_1)
443     " PKCS#1 "
444 #endif
445 #if defined(LTC_PKCS_5)
446     " PKCS#5 "
447 #endif
448 #if defined(LTC_PKCS_8)
449     " PKCS#8 "
450 #endif
451 #if defined(LTC_PKCS_12)
452     " PKCS#12 "
453 #endif
454 #if defined(LTC_PADDING)
455     " PADDING "
456 #endif
457 #if defined(LTC_HKDF)
458     " HKDF "
459 #endif
460 #if defined(LTC_PBES)
461     " PBES1 "
462     " PBES2 "
463 #endif
464 #if defined(LTC_SSH)
465     " SSH "
466 #endif
467 #if defined(LTC_DEVRANDOM)
468     " LTC_DEVRANDOM "
469 #endif
470 #if defined(LTC_TRY_URANDOM_FIRST)
471     " LTC_TRY_URANDOM_FIRST "
472 #endif
473 #if defined(LTC_RNG_GET_BYTES)
474     " LTC_RNG_GET_BYTES "
475 #endif
476 #if defined(LTC_RNG_MAKE_PRNG)
477     " LTC_RNG_MAKE_PRNG "
478 #endif
479 #if defined(LTC_PRNG_ENABLE_LTC_RNG)
480     " LTC_PRNG_ENABLE_LTC_RNG "
481 #endif
482 #if defined(LTC_HASH_HELPERS)
483     " LTC_HASH_HELPERS "
484 #endif
485 #if defined(LTC_VALGRIND)
486     " LTC_VALGRIND "
487 #endif
488 #if defined(LTC_TEST)
489     " LTC_TEST "
490 #endif
491 #if defined(LTC_TEST_DBG)
492     " " NAME_VALUE(LTC_TEST_DBG) " "
493 #endif
494 #if defined(LTC_TEST_EXT)
495     " LTC_TEST_EXT "
496 #endif
497 #if defined(LTC_SMALL_CODE)
498     " LTC_SMALL_CODE "
499 #endif
500 #if defined(LTC_NO_FILE)
501     " LTC_NO_FILE "
502 #endif
503 #if defined(LTC_FILE_READ_BUFSIZE)
504     " " NAME_VALUE(LTC_FILE_READ_BUFSIZE) " "
505 #endif
506 #if defined(LTC_FAST)
507     " LTC_FAST "
508 #endif
509 #if defined(LTC_NO_FAST)
510     " LTC_NO_FAST "
511 #endif
512 #if defined(LTC_NO_BSWAP)
513     " LTC_NO_BSWAP "
514 #endif
515 #if defined(LTC_NO_ASM)
516     " LTC_NO_ASM "
517 #endif
518 #if defined(LTC_ROx_BUILTIN)
519     " LTC_ROx_BUILTIN "
520 #elif defined(LTC_ROx_ASM)
521     " LTC_ROx_ASM "
522 #if defined(LTC_NO_ROLC)
523     " LTC_NO_ROLC "
524 #endif
525 #endif
526 #if defined(LTC_NO_TEST)
527     " LTC_NO_TEST "
528 #endif
529 #if defined(LTC_NO_TABLES)
530     " LTC_NO_TABLES "
531 #endif
532 #if defined(LTC_PTHREAD)
533     " LTC_PTHREAD "
534 #endif
535 #if defined(LTC_EASY)
536     " LTC_EASY "
537 #endif
538 #if defined(LTC_MECC_ACCEL)
539     " LTC_MECC_ACCEL "
540 #endif
541 #if defined(LTC_MECC_FP)
542     " LTC_MECC_FP "
543 #endif
544 #if defined(LTC_ECC_SHAMIR)
545     " LTC_ECC_SHAMIR "
546 #endif
547 #if defined(LTC_CLOCK_GETTIME)
548     " LTC_CLOCK_GETTIME "
549 #endif
550     "\n"
551     ;
552 
553