Mercurial > dropbear
comparison libtomcrypt/src/headers/tomcrypt_misc.h @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis | |
2 * | |
3 * LibTomCrypt is a library that provides various cryptographic | |
4 * algorithms in a highly modular and flexible manner. | |
5 * | |
6 * The library is free for all purposes without any express | |
7 * guarantee it works. | |
8 */ | |
9 | |
1 /* ---- LTC_BASE64 Routines ---- */ | 10 /* ---- LTC_BASE64 Routines ---- */ |
2 #ifdef LTC_BASE64 | 11 #ifdef LTC_BASE64 |
3 int base64_encode(const unsigned char *in, unsigned long len, | 12 int base64_encode(const unsigned char *in, unsigned long len, |
4 unsigned char *out, unsigned long *outlen); | 13 unsigned char *out, unsigned long *outlen); |
5 | 14 |
6 int base64_decode(const unsigned char *in, unsigned long len, | 15 int base64_decode(const unsigned char *in, unsigned long len, |
16 unsigned char *out, unsigned long *outlen); | |
17 int base64_strict_decode(const unsigned char *in, unsigned long len, | |
7 unsigned char *out, unsigned long *outlen); | 18 unsigned char *out, unsigned long *outlen); |
8 #endif | 19 #endif |
9 | 20 |
21 #ifdef LTC_BASE64_URL | |
22 int base64url_encode(const unsigned char *in, unsigned long len, | |
23 unsigned char *out, unsigned long *outlen); | |
24 int base64url_strict_encode(const unsigned char *in, unsigned long inlen, | |
25 unsigned char *out, unsigned long *outlen); | |
26 | |
27 int base64url_decode(const unsigned char *in, unsigned long len, | |
28 unsigned char *out, unsigned long *outlen); | |
29 int base64url_strict_decode(const unsigned char *in, unsigned long len, | |
30 unsigned char *out, unsigned long *outlen); | |
31 #endif | |
32 | |
33 /* ===> LTC_HKDF -- RFC5869 HMAC-based Key Derivation Function <=== */ | |
34 #ifdef LTC_HKDF | |
35 | |
36 int hkdf_test(void); | |
37 | |
38 int hkdf_extract(int hash_idx, | |
39 const unsigned char *salt, unsigned long saltlen, | |
40 const unsigned char *in, unsigned long inlen, | |
41 unsigned char *out, unsigned long *outlen); | |
42 | |
43 int hkdf_expand(int hash_idx, | |
44 const unsigned char *info, unsigned long infolen, | |
45 const unsigned char *in, unsigned long inlen, | |
46 unsigned char *out, unsigned long outlen); | |
47 | |
48 int hkdf(int hash_idx, | |
49 const unsigned char *salt, unsigned long saltlen, | |
50 const unsigned char *info, unsigned long infolen, | |
51 const unsigned char *in, unsigned long inlen, | |
52 unsigned char *out, unsigned long outlen); | |
53 | |
54 #endif /* LTC_HKDF */ | |
55 | |
10 /* ---- MEM routines ---- */ | 56 /* ---- MEM routines ---- */ |
11 void zeromem(void *dst, size_t len); | 57 int mem_neq(const void *a, const void *b, size_t len); |
58 void zeromem(volatile void *dst, size_t len); | |
12 void burn_stack(unsigned long len); | 59 void burn_stack(unsigned long len); |
13 | 60 |
14 const char *error_to_string(int err); | 61 const char *error_to_string(int err); |
15 | 62 |
16 extern const char *crypt_build_settings; | 63 extern const char *crypt_build_settings; |
17 | 64 |
18 /* ---- HMM ---- */ | 65 /* ---- HMM ---- */ |
19 int crypt_fsa(void *mp, ...); | 66 int crypt_fsa(void *mp, ...); |
20 | 67 |
21 /* $Source$ */ | 68 /* ---- Dynamic language support ---- */ |
22 /* $Revision$ */ | 69 int crypt_get_constant(const char* namein, int *valueout); |
23 /* $Date$ */ | 70 int crypt_list_all_constants(char *names_list, unsigned int *names_list_size); |
71 | |
72 int crypt_get_size(const char* namein, unsigned int *sizeout); | |
73 int crypt_list_all_sizes(char *names_list, unsigned int *names_list_size); | |
74 | |
75 #ifdef LTM_DESC | |
76 void init_LTM(void); | |
77 #endif | |
78 #ifdef TFM_DESC | |
79 void init_TFM(void); | |
80 #endif | |
81 #ifdef GMP_DESC | |
82 void init_GMP(void); | |
83 #endif | |
84 | |
85 #ifdef LTC_ADLER32 | |
86 typedef struct adler32_state_s | |
87 { | |
88 unsigned short s[2]; | |
89 } adler32_state; | |
90 | |
91 void adler32_init(adler32_state *ctx); | |
92 void adler32_update(adler32_state *ctx, const unsigned char *input, unsigned long length); | |
93 void adler32_finish(adler32_state *ctx, void *hash, unsigned long size); | |
94 int adler32_test(void); | |
95 #endif | |
96 | |
97 #ifdef LTC_CRC32 | |
98 typedef struct crc32_state_s | |
99 { | |
100 ulong32 crc; | |
101 } crc32_state; | |
102 | |
103 void crc32_init(crc32_state *ctx); | |
104 void crc32_update(crc32_state *ctx, const unsigned char *input, unsigned long length); | |
105 void crc32_finish(crc32_state *ctx, void *hash, unsigned long size); | |
106 int crc32_test(void); | |
107 #endif | |
108 | |
109 int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which); | |
110 | |
111 /* ref: $Format:%D$ */ | |
112 /* git commit: $Format:%H$ */ | |
113 /* commit time: $Format:%ai$ */ |