diff options
author | Stephen R. van den Berg <srb@cuci.nl> | 2020-06-12 11:11:46 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2020-06-30 21:34:05 +0200 |
commit | 66b4fde632427295628667c6285151f973385d30 (patch) | |
tree | 87667c2864b21532436ee9f6b5e544572ce935a4 /blowfish.h | |
parent | e183f3bce626bd802c40ed4142858d0b8b8a0914 (diff) | |
download | nettle-66b4fde632427295628667c6285151f973385d30.tar.gz |
blowfish: Add bcrypt support.
Diffstat (limited to 'blowfish.h')
-rw-r--r-- | blowfish.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -46,6 +46,8 @@ extern "C" { #define blowfish128_set_key nettle_blowfish128_set_key #define blowfish_encrypt nettle_blowfish_encrypt #define blowfish_decrypt nettle_blowfish_decrypt +#define blowfish_bcrypt_hash nettle_blowfish_bcrypt_hash +#define blowfish_bcrypt_verify nettle_blowfish_bcrypt_verify #define BLOWFISH_BLOCK_SIZE 8 @@ -60,6 +62,9 @@ extern "C" { #define _BLOWFISH_ROUNDS 16 +#define BLOWFISH_BCRYPT_HASH_SIZE (60 + 1) /* Including null-terminator */ +#define BLOWFISH_BCRYPT_BINSALT_SIZE 16 /* Binary string size */ + struct blowfish_ctx { uint32_t s[4][256]; @@ -82,6 +87,18 @@ blowfish_decrypt(const struct blowfish_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); +/* dst parameter must point to a buffer of minimally + * BLOWFISH_BCRYPT_HASH_SIZE bytes */ +int +blowfish_bcrypt_hash(uint8_t *dst, + size_t lenkey, const uint8_t *key, + size_t lenscheme, const uint8_t *scheme, + int log2rounds, + const uint8_t *salt); +int +blowfish_bcrypt_verify(size_t lenkey, const uint8_t *key, + size_t lenhashed, const uint8_t *hashed); + #ifdef __cplusplus } #endif |