summaryrefslogtreecommitdiff
path: root/pbkdf2.h
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2012-09-19 22:55:06 +0200
committerNiels Möller <nisse@lysator.liu.se>2012-09-19 22:55:06 +0200
commit24f3cce7bca7f58cb0eb9eff7674d3c0f9302538 (patch)
tree6403b0bf082b2c0eb8bbd56bbdedbee732ef5a19 /pbkdf2.h
parent75288e447e2a659b7c4df915d81c426bda4435c7 (diff)
downloadnettle-24f3cce7bca7f58cb0eb9eff7674d3c0f9302538.tar.gz
Support for pbkdf2.
Diffstat (limited to 'pbkdf2.h')
-rw-r--r--pbkdf2.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/pbkdf2.h b/pbkdf2.h
new file mode 100644
index 00000000..59719ae1
--- /dev/null
+++ b/pbkdf2.h
@@ -0,0 +1,60 @@
+/* pbkdf2.c
+ *
+ * PKCS #5 password-based key derivation function PBKDF2, see RFC 2898.
+ */
+
+/* nettle, low-level cryptographics library
+ *
+ * Copyright (C) 2012 Simon Josefsson
+ *
+ * The nettle library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at your
+ * option) any later version.
+ *
+ * The nettle library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the nettle library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02111-1301, USA.
+ */
+
+#ifndef NETTLE_PBKDF2_H_INCLUDED
+#define NETTLE_PBKDF2_H_INCLUDED
+
+#include "nettle-meta.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* Namespace mangling */
+#define pbkdf2 nettle_pbkdf2
+
+void
+pbkdf2 (void *mac_ctx, unsigned digest_size,
+ nettle_hash_update_func *update,
+ nettle_hash_digest_func *digest,
+ unsigned length, uint8_t *dst,
+ unsigned iterations,
+ unsigned salt_length, const uint8_t *salt);
+
+#define PBKDF2(ctx, digest_size, update, digest, \
+ length, dst, iterations, salt_length, salt) \
+ (0 ? ((update)((ctx), 0, (const uint8_t *) 0), \
+ (digest)((ctx), 0, (uint8_t *) 0)) \
+ : pbkdf2 ((ctx), (digest_size), \
+ (nettle_hash_update_func *)(update), \
+ (nettle_hash_digest_func *)(digest), \
+ (length), (dst), (iterations), (salt_length), (salt)))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NETTLE_PBKDF2_H_INCLUDED */