| 1 | /* |
| 2 | * fastpbkdf2 - Faster PBKDF2-HMAC calculation |
| 3 | * Written in 2015 by Joseph Birr-Pixton <[email protected]> |
| 4 | * |
| 5 | * To the extent possible under law, the author(s) have dedicated all |
| 6 | * copyright and related and neighboring rights to this software to the |
| 7 | * public domain worldwide. This software is distributed without any |
| 8 | * warranty. |
| 9 | * |
| 10 | * You should have received a copy of the CC0 Public Domain Dedication |
| 11 | * along with this software. If not, see |
| 12 | * <http://creativecommons.org/publicdomain/zero/1.0/>. |
| 13 | */ |
| 14 | /* librist. Copyright © 2019 SipRadius LLC. All right reserved. |
| 15 | * Author: Kuldeep Singh Dhaka <[email protected]> |
| 16 | * Author: Sergio Ammirata, Ph.D. <[email protected]> |
| 17 | * |
| 18 | * Note: Removed SHA1 and SHA512 as the functions are not available |
| 19 | */ |
| 20 | |
| 21 | #ifndef FASTPBKDF2_H |
| 22 | #define FASTPBKDF2_H |
| 23 | |
| 24 | #include <stdlib.h> |
| 25 | #include <stdint.h> |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | /** Calculates PBKDF2-HMAC-SHA256. |
| 32 | * |
| 33 | * @p npw bytes at @p pw are the password input. |
| 34 | * @p nsalt bytes at @p salt are the salt input. |
| 35 | * @p iterations is the PBKDF2 iteration count and must be non-zero. |
| 36 | * @p nout bytes of output are written to @p out. @p nout must be non-zero. |
| 37 | * |
| 38 | * This function cannot fail; it does not report errors. |
| 39 | */ |
| 40 | void fastpbkdf2_hmac_sha256(const uint8_t *pw, size_t npw, |
| 41 | const uint8_t *salt, size_t nsalt, |
| 42 | uint32_t iterations, |
| 43 | uint8_t *out, size_t nout); |
| 44 | |
| 45 | #ifdef __cplusplus |
| 46 | } |
| 47 | #endif |
| 48 | |
| 49 | #endif |