fix -p, so we don't need to supply a pattern
[shallot.git] / src / defines.h
blob17f54427583e5954e955d9f0ffdef62a6424ceec
1 #ifndef DEFINES_H
2 #define DEFINES_H
4 #include "config.h"
5 #include <inttypes.h>
7 // our ever-important version string
8 #define VERSION "0.0.3-alpha"
10 // default values
11 #define DEFAULT_THREADS 1 // not used on anything but unknown systems
12 #define DEFAULT_E_LIMIT 0xFFFFFFFFFFull // must be odd and <= MAXIMUM_E_LIMIT
13 // and >= RSA_PK_EXPONENT
14 #define MAXIMUM_E_LIMIT 0xFFFFFFFFFFFFFFFDull
16 // crypt constants
17 #define REGEX_COMP_LMAX 0x40
18 #define SHA1_DIGEST_LEN 20
19 #define RSA_KEYS_BITLEN 0x400
20 #define RSA_OPTM_BITLEN 0x380 // remember to subtract the length of e (in bits)
21 // be sure to keep these constants in sync if you change them!
22 #define RSA_PK_EXPONENT 0x10001ull
23 #define RSA_PK_E_LENGTH 3
24 #define RSA_EXP_DER_LEN 0x8C
25 #define RSA_OPT_DER_LEN 0x77
26 #define RSA_ADD_DER_OFF 2 // don't ask...
27 #define SHA_REL_CTX_LEN 10 * sizeof(SHA_LONG)
29 #define BASE32_ONIONLEN 16
30 #define BASE32_ALPHABET "abcdefghijklmnopqrstuvwxyz234567"
32 #define PRINT_ONION_STR "Found matching domain after %"PRIi64" tries: %s.onion"
33 #define PRINT_ONION_MAX 79
35 #ifdef LINUX_PORT
36 // Linux constants (lol no API)
37 #define CPUINFO_BUF_SIZE 0x400
38 #define CPUINFO_PATH "/proc/cpuinfo"
39 #define CPUINFO_PROC_STR "processor"
40 #define CPUINFO_PROC_STR_LEN 9 // don't include trailing NULL
41 // sanity checking for constants
42 #if CPUINFO_BUF_SIZE < 0x100
43 #error CPUINFO_BUFFER_SIZE set too small. Please make it bigger.
44 #elif CPUINFO_BUF_SIZE > 0x7FFF
45 #error CPUINFO_BUFFER_SIZE set too large. Please make it smaller.
46 #endif
47 #endif
49 #endif