Skip to content

Commit

Permalink
sys/hash/pbkdf2: Accept passwd as void * instead of uint8_t *
Browse files Browse the repository at this point in the history
Having to cast a password provided as `const char *` to
`const uint8_t *` is a needless pain in the ass when using the API.
Hence, fix it by accepting passwords and salts as `const void *`
instead.
  • Loading branch information
maribu committed Nov 18, 2022
1 parent 29812d0 commit e92a716
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sys/hashes/pbkdf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ static void inplace_xor_digests(uint8_t *d1, const uint8_t *d2)
}
}

void pbkdf2_sha256(const uint8_t *password, size_t password_len,
const uint8_t *salt, size_t salt_len,
void pbkdf2_sha256(const void *password, size_t password_len,
const void *salt, size_t salt_len,
int iterations,
uint8_t *output)
{
Expand Down
4 changes: 2 additions & 2 deletions sys/include/hashes/pbkdf2.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ extern "C" {
* recommended 10000
* @param[out] output array of size PBKDF2_KEY_SIZE
*/
void pbkdf2_sha256(const uint8_t *password, size_t password_len,
const uint8_t *salt, size_t salt_len,
void pbkdf2_sha256(const void *password, size_t password_len,
const void *salt, size_t salt_len,
int iterations,
uint8_t *output);

Expand Down

0 comments on commit e92a716

Please sign in to comment.