1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 
4 #ifndef TOMCRYPT_H_
5 #define TOMCRYPT_H_
6 #include <assert.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <stdlib.h>
10 #include <stddef.h>
11 #include <time.h>
12 #include <ctype.h>
13 #include <limits.h>
14 
15 /* use configuration data */
16 #include "tomcrypt_custom.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /* version */
23 #define CRYPT   0x0118
24 #define SCRYPT  "1.18.2-develop"
25 
26 /* max size of either a cipher/hash block or symmetric key [largest of the two] */
27 #define MAXBLOCKSIZE  144
28 
29 #ifndef TAB_SIZE
30 /* descriptor table size */
31 #define TAB_SIZE      34
32 #endif
33 
34 /* error codes [will be expanded in future releases] */
35 enum {
36    CRYPT_OK=0,             /* Result OK */
37    CRYPT_ERROR,            /* Generic Error */
38    CRYPT_NOP,              /* Not a failure but no operation was performed */
39 
40    CRYPT_INVALID_KEYSIZE,  /* Invalid key size given */
41    CRYPT_INVALID_ROUNDS,   /* Invalid number of rounds */
42    CRYPT_FAIL_TESTVECTOR,  /* Algorithm failed test vectors */
43 
44    CRYPT_BUFFER_OVERFLOW,  /* Not enough space for output */
45    CRYPT_INVALID_PACKET,   /* Invalid input packet given */
46 
47    CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */
48    CRYPT_ERROR_READPRNG,   /* Could not read enough from PRNG */
49 
50    CRYPT_INVALID_CIPHER,   /* Invalid cipher specified */
51    CRYPT_INVALID_HASH,     /* Invalid hash specified */
52    CRYPT_INVALID_PRNG,     /* Invalid PRNG specified */
53 
54    CRYPT_MEM,              /* Out of memory */
55 
56    CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */
57    CRYPT_PK_NOT_PRIVATE,   /* Requires a private PK key */
58 
59    CRYPT_INVALID_ARG,      /* Generic invalid argument */
60    CRYPT_FILE_NOTFOUND,    /* File Not Found */
61 
62    CRYPT_PK_INVALID_TYPE,  /* Invalid type of PK key */
63 
64    CRYPT_OVERFLOW,         /* An overflow of a value was detected/prevented */
65 
66    CRYPT_PK_ASN1_ERROR,    /* An error occurred while en- or decoding ASN.1 data */
67 
68    CRYPT_INPUT_TOO_LONG,   /* The input was longer than expected. */
69 
70    CRYPT_PK_INVALID_SIZE,  /* Invalid size input for PK parameters */
71 
72    CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */
73    CRYPT_PK_INVALID_PADDING, /* Invalid padding on input */
74 
75    CRYPT_HASH_OVERFLOW      /* Hash applied to too many bits */
76 };
77 
78 #include "tomcrypt_cfg.h"
79 #include "tomcrypt_macros.h"
80 #include "tomcrypt_cipher.h"
81 #include "tomcrypt_hash.h"
82 #include "tomcrypt_mac.h"
83 #include "tomcrypt_prng.h"
84 #include "tomcrypt_pk.h"
85 #include "tomcrypt_math.h"
86 #include "tomcrypt_misc.h"
87 #include "tomcrypt_argchk.h"
88 #include "tomcrypt_pkcs.h"
89 
90 #ifdef __cplusplus
91    }
92 #endif
93 
94 #endif /* TOMCRYPT_H_ */
95 
96