summaryrefslogtreecommitdiff
path: root/blowfish.h
diff options
context:
space:
mode:
authorStephen R. van den Berg <srb@cuci.nl>2020-06-12 11:11:46 +0200
committerNiels Möller <nisse@lysator.liu.se>2020-06-30 21:34:05 +0200
commit66b4fde632427295628667c6285151f973385d30 (patch)
tree87667c2864b21532436ee9f6b5e544572ce935a4 /blowfish.h
parente183f3bce626bd802c40ed4142858d0b8b8a0914 (diff)
downloadnettle-66b4fde632427295628667c6285151f973385d30.tar.gz
blowfish: Add bcrypt support.
Diffstat (limited to 'blowfish.h')
-rw-r--r--blowfish.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/blowfish.h b/blowfish.h
index bcdc7cb6..01813cbc 100644
--- a/blowfish.h
+++ b/blowfish.h
@@ -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