1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-24 04:25:10 -07:00

All the crypto_pwhash_* macros do not need to be exposed.

This commit is contained in:
Frank Denis 2014-05-07 15:30:04 -07:00
parent 4ef1a332d1
commit fa05d907bf
4 changed files with 11 additions and 13 deletions

View File

@ -26,11 +26,6 @@
#include "runtime.h"
#include "utils.h"
#define BYTES2CHARS(bytes) \
((((bytes) * 8) + 5) / 6)
#define HASH_LEN BYTES2CHARS(crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES) /* base-64 chars */
static const char * const itoa64 =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@ -153,7 +148,8 @@ escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen,
} else {
saltlen = strlen((char *)salt);
}
need = prefixlen + saltlen + 1 + HASH_LEN + 1;
need = prefixlen + saltlen + 1 +
crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED + 1;
if (need > buflen || need < saltlen) {
return NULL;
}

View File

@ -32,6 +32,15 @@
#include <stdint.h>
#define crypto_pwhash_scryptxsalsa208sha256_STRPREFIXBYTES 14
#define crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES 57
#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES 32
#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES_ENCODED 43
#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES 32
#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED 43
#define BYTES2CHARS(bytes) ((((bytes) * 8) + 5) / 6)
/**
* crypto_scrypt_compat(passwd, passwdlen, salt, saltlen, N, r, p, buf, buflen):
* Compute scrypt(passwd[0 .. passwdlen - 1], salt[0 .. saltlen - 1], N, r,

View File

@ -8,7 +8,6 @@
#include "crypto_scrypt.h"
#include "randombytes.h"
#define BYTES2CHARS(bytes) ((((bytes) * 8) + 5) / 6)
#define SETTING_SIZE(saltbytes) \
(sizeof "$7$" - 1U) + \
(1U /* N_log2 */) + (5U /* r */) + (5U /* p */) + BYTES2CHARS(saltbytes)

View File

@ -8,12 +8,6 @@
#define crypto_pwhash_scryptxsalsa208sha256_SALTBYTES 32
#define crypto_pwhash_scryptxsalsa208sha256_STRBYTES 102
#define crypto_pwhash_scryptxsalsa208sha256_STRPREFIXBYTES 14
#define crypto_pwhash_scryptxsalsa208sha256_STRSETTINGBYTES 57
#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES 32
#define crypto_pwhash_scryptxsalsa208sha256_STRSALTBYTES_ENCODED 43
#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES 32
#define crypto_pwhash_scryptxsalsa208sha256_STRHASHBYTES_ENCODED 43
#ifdef __cplusplus
# if __GNUC__