summaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-17 12:53:13 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-19 07:46:22 +0100
commit5f5d5331bb5e029264b9bc0cfbb3c32ec3158638 (patch)
tree000e810fd69a7a6de90fc7ba88c8688068092bb4 /include/crypto
parent18d778a06efe5bfc1984b34c6bc6b79e6ed6ecd1 (diff)
downloadbarebox-5f5d5331bb5e029264b9bc0cfbb3c32ec3158638.tar.gz
barebox-5f5d5331bb5e029264b9bc0cfbb3c32ec3158638.tar.xz
crypto: add pbkdf2 hmac key generator
this will allow to generate a KEY + IV based on a password and salt for AES encryption/decryption as example or simply the key for hmac or rsa from text password Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/pbkdf2.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/crypto/pbkdf2.h b/include/crypto/pbkdf2.h
new file mode 100644
index 0000000000..fa66675261
--- /dev/null
+++ b/include/crypto/pbkdf2.h
@@ -0,0 +1,23 @@
+/*
+ * (C) Copyright 2015 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
+ *
+ * Under GPLv2 Only
+ */
+
+#ifndef __PBKDF2_H__
+#define __PBKDF2_H__
+
+#include <digest.h>
+
+int pkcs5_pbkdf2_hmac_sha1(const unsigned char *pwd, size_t pwd_len,
+ const unsigned char *salt, size_t salt_len,
+ uint32_t iteration,
+ uint32_t key_len, unsigned char *buf);
+
+int pkcs5_pbkdf2_hmac(struct digest* d,
+ const unsigned char *pwd, size_t pwd_len,
+ const unsigned char *salt, size_t salt_len,
+ uint32_t iteration,
+ uint32_t key_len, unsigned char *key);
+
+#endif /* __PBKDF2_H__ */