LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
tomcrypt.h
Go to the documentation of this file.
1#ifndef TOMCRYPT_H_
2#define TOMCRYPT_H_
3#include <assert.h>
4#include <stdio.h>
5#include <string.h>
6#include <stdlib.h>
7#include <time.h>
8#include <ctype.h>
9#include <limits.h>
10#include "logicalaccess/plugins/crypto/lla_crypto_api.hpp"
11
12// We keep the TomCrypt define/macro to use other TomCrypt algorithm in further time
13#define LTC_NO_CIPHERS
14#define LTC_DES
15#define LTC_NO_HASHES
16#define LTC_NO_MACS
17#define LTC_NO_PRNGS
18#define LTC_NO_PK
19#define LTC_NO_PKCS
20#define LTC_NO_PROTOTYPES
21
22/* use configuration data */
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29 /* version */
30#define CRYPT 0x0117
31#define SCRYPT "1.17"
32
33 /* max size of either a cipher/hash block or symmetric key [largest of the two] */
34#define MAXBLOCKSIZE 128
35
36 /* descriptor table size */
37#define TAB_SIZE 32
38
39 /* error codes [will be expanded in future releases] */
40 enum {
41 CRYPT_OK = 0, /* Result OK */
42 CRYPT_ERROR, /* Generic Error */
43 CRYPT_NOP, /* Not a failure but no operation was performed */
44
45 CRYPT_INVALID_KEYSIZE, /* Invalid key size given */
46 CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */
47 CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */
48
49 CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */
50 CRYPT_INVALID_PACKET, /* Invalid input packet given */
51
52 CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */
53 CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */
54
55 CRYPT_INVALID_CIPHER, /* Invalid cipher specified */
56 CRYPT_INVALID_HASH, /* Invalid hash specified */
57 CRYPT_INVALID_PRNG, /* Invalid PRNG specified */
58
59 CRYPT_MEM, /* Out of memory */
60
61 CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */
62 CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */
63
64 CRYPT_INVALID_ARG, /* Generic invalid argument */
65 CRYPT_FILE_NOTFOUND, /* File Not Found */
66
67 CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */
68 CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */
69 CRYPT_PK_DUP, /* Duplicate key already in key ring */
70 CRYPT_PK_NOT_FOUND, /* Key not found in keyring */
71 CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */
72
73 CRYPT_INVALID_PRIME_SIZE,/* Invalid size of prime requested */
74 CRYPT_PK_INVALID_PADDING /* Invalid padding on input */
75 };
76
80 /*#include <tomcrypt_hash.h>
81 #include <tomcrypt_mac.h>
82 #include <tomcrypt_prng.h>
83 #include <tomcrypt_pk.h>
84 #include <tomcrypt_math.h>
85 #include <tomcrypt_misc.h>*/
87 /*#include <tomcrypt_pkcs.h>*/
88
89#define CRC_A 1
90#define CRC_B 2
91
92 unsigned short UpdateCrc(unsigned char ch, unsigned short *lpwCrc);
93
94 LLA_CRYPTO_API void ComputeCrc(int CRCType, const unsigned char *Data,
95 size_t Length, unsigned char *TransmitFirst,
96 unsigned char *TransmitSecond);
97
98 LLA_CRYPTO_API void ComputeCrcCCITT(unsigned short crc_old,
99 const unsigned char *Data, size_t Length,
100 unsigned char *TransmitFirst,
101 unsigned char *TransmitSecond);
102
103 LLA_CRYPTO_API unsigned short UpdateCRCKermit(unsigned short crc, char c);
104
105 LLA_CRYPTO_API void ComputeCrcKermit(const unsigned char *Data, size_t Length,
106 unsigned char *TransmitFirst,
107 unsigned char *TransmitSecond);
108
112 LLA_CRYPTO_API const char *error_to_string(int errcode);
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* TOMCRYPT_H_ */
119
120/* $Source$ */
121/* $Revision$ */
122/* $Date$ */
@ CRYPT_ERROR
Definition: tomcrypt.h:42
@ CRYPT_MEM
Definition: tomcrypt.h:59
@ CRYPT_PK_INVALID_TYPE
Definition: tomcrypt.h:67
@ CRYPT_INVALID_CIPHER
Definition: tomcrypt.h:55
@ CRYPT_PK_TYPE_MISMATCH
Definition: tomcrypt.h:61
@ CRYPT_INVALID_PRIME_SIZE
Definition: tomcrypt.h:73
@ CRYPT_PK_INVALID_SYSTEM
Definition: tomcrypt.h:68
@ CRYPT_INVALID_PRNG
Definition: tomcrypt.h:57
@ CRYPT_ERROR_READPRNG
Definition: tomcrypt.h:53
@ CRYPT_INVALID_ROUNDS
Definition: tomcrypt.h:46
@ CRYPT_PK_NOT_FOUND
Definition: tomcrypt.h:70
@ CRYPT_INVALID_ARG
Definition: tomcrypt.h:64
@ CRYPT_INVALID_PACKET
Definition: tomcrypt.h:50
@ CRYPT_FILE_NOTFOUND
Definition: tomcrypt.h:65
@ CRYPT_INVALID_KEYSIZE
Definition: tomcrypt.h:45
@ CRYPT_PK_NOT_PRIVATE
Definition: tomcrypt.h:62
@ CRYPT_INVALID_PRNGSIZE
Definition: tomcrypt.h:52
@ CRYPT_NOP
Definition: tomcrypt.h:43
@ CRYPT_BUFFER_OVERFLOW
Definition: tomcrypt.h:49
@ CRYPT_OK
Definition: tomcrypt.h:41
@ CRYPT_PK_INVALID_SIZE
Definition: tomcrypt.h:71
@ CRYPT_PK_DUP
Definition: tomcrypt.h:69
@ CRYPT_INVALID_HASH
Definition: tomcrypt.h:56
@ CRYPT_PK_INVALID_PADDING
Definition: tomcrypt.h:74
@ CRYPT_FAIL_TESTVECTOR
Definition: tomcrypt.h:47
LLA_CRYPTO_API unsigned short UpdateCRCKermit(unsigned short crc, char c)
Definition: des.cpp:3041
LLA_CRYPTO_API void ComputeCrc(int CRCType, const unsigned char *Data, size_t Length, unsigned char *TransmitFirst, unsigned char *TransmitSecond)
Definition: des.cpp:2974
LLA_CRYPTO_API void ComputeCrcKermit(const unsigned char *Data, size_t Length, unsigned char *TransmitFirst, unsigned char *TransmitSecond)
Definition: des.cpp:3024
unsigned short UpdateCrc(unsigned char ch, unsigned short *lpwCrc)
Definition: des.cpp:2965
LLA_CRYPTO_API const char * error_to_string(int errcode)
Definition: tomcrypt_error_to_string.cpp:49
LLA_CRYPTO_API void ComputeCrcCCITT(unsigned short crc_old, const unsigned char *Data, size_t Length, unsigned char *TransmitFirst, unsigned char *TransmitSecond)
Definition: des.cpp:3004