13 #ifndef TOR_CRYPTO_S2K_H_INCLUDED
14 #define TOR_CRYPTO_S2K_H_INCLUDED
21 #define S2K_RFC2440_SPECIFIER_LEN 9
23 char *key_out,
size_t key_out_len,
const char *secret,
24 size_t secret_len,
const char *s2k_specifier);
27 #define S2K_FLAG_NO_SCRYPT (1u<<0)
30 #define S2K_FLAG_LOW_MEM (1u<<1)
33 #define S2K_FLAG_USE_PBKDF2 (1u<<2)
43 #define S2K_BAD_SECRET -2
45 #define S2K_BAD_ALGORITHM -3
47 #define S2K_BAD_PARAMS -4
49 #define S2K_NO_SCRYPT_SUPPORT -5
52 #define S2K_TRUNCATED -6
54 #define S2K_BAD_LEN -7
59 const char *secret,
size_t secret_len,
65 const char *secret,
size_t secret_len);
68 const uint8_t *spec,
size_t spec_len,
69 const char *secret,
size_t secret_len);
71 #ifdef CRYPTO_S2K_PRIVATE
73 const uint8_t *spec,
size_t spec_len,
74 const char *secret,
size_t secret_len,
STATIC int secret_to_key_compute_key(uint8_t *key_out, size_t key_out_len, const uint8_t *spec, size_t spec_len, const char *secret, size_t secret_len, int type)
int secret_to_key_new(uint8_t *buf, size_t buf_len, size_t *len_out, const char *secret, size_t secret_len, unsigned flags)
int secret_to_key_check(const uint8_t *spec_and_key, size_t spec_and_key_len, const char *secret, size_t secret_len)
int secret_to_key_derivekey(uint8_t *key_out, size_t key_out_len, const uint8_t *spec, size_t spec_len, const char *secret, size_t secret_len)
int secret_to_key_make_specifier(uint8_t *buf, size_t buf_len, unsigned flags)
void secret_to_key_rfc2440(char *key_out, size_t key_out_len, const char *secret, size_t secret_len, const char *s2k_specifier)
Integer definitions used throughout Tor.