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