mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-24 20:45:17 -07:00
pwhash never supported "in-place" operation - return EINVAL
This commit is contained in:
parent
dbbd8c6bb9
commit
4aa74923d2
@ -163,6 +163,10 @@ crypto_pwhash_argon2i(unsigned char *const out, unsigned long long outlen,
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ((const void *) out == (const void *) passwd) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
switch (alg) {
|
switch (alg) {
|
||||||
case crypto_pwhash_argon2i_ALG_ARGON2I13:
|
case crypto_pwhash_argon2i_ALG_ARGON2I13:
|
||||||
if (argon2i_hash_raw((uint32_t) opslimit, (uint32_t) (memlimit / 1024U),
|
if (argon2i_hash_raw((uint32_t) opslimit, (uint32_t) (memlimit / 1024U),
|
||||||
|
@ -159,6 +159,10 @@ crypto_pwhash_argon2id(unsigned char *const out, unsigned long long outlen,
|
|||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if ((const void *) out == (const void *) passwd) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
switch (alg) {
|
switch (alg) {
|
||||||
case crypto_pwhash_argon2id_ALG_ARGON2ID13:
|
case crypto_pwhash_argon2id_ALG_ARGON2ID13:
|
||||||
if (argon2id_hash_raw((uint32_t) opslimit, (uint32_t) (memlimit / 1024U),
|
if (argon2id_hash_raw((uint32_t) opslimit, (uint32_t) (memlimit / 1024U),
|
||||||
|
@ -176,6 +176,10 @@ crypto_pwhash_scryptsalsa208sha256(unsigned char *const out,
|
|||||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||||
return -1; /* LCOV_EXCL_LINE */
|
return -1; /* LCOV_EXCL_LINE */
|
||||||
}
|
}
|
||||||
|
if ((const void *) out == (const void *) passwd) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return crypto_pwhash_scryptsalsa208sha256_ll(
|
return crypto_pwhash_scryptsalsa208sha256_ll(
|
||||||
(const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) salt,
|
(const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) salt,
|
||||||
crypto_pwhash_scryptsalsa208sha256_SALTBYTES, (uint64_t)(1) << N_log2,
|
crypto_pwhash_scryptsalsa208sha256_SALTBYTES, (uint64_t)(1) << N_log2,
|
||||||
|
Loading…
Reference in New Issue
Block a user