blob: e842c838a7600ab6a98eb412c626390137f63e05 [file] [log] [blame]
Paul Bakkerf518b162012-08-23 13:03:18 +00001/**
2 * \file pbkdf2.h
3 *
4 * \brief Password-Based Key Derivation Function 2 (from PKCS#5)
Manuel Pégourié-Gonnard71432842015-03-20 16:19:35 +00005 *
6 * \deprecated Use pkcs5.h instead.
Paul Bakkerf518b162012-08-23 13:03:18 +00007 *
8 * \author Mathias Olsson <mathias@kompetensum.com>
9 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +000010 * Copyright (C) 2006-2012, ARM Limited, All Rights Reserved
Paul Bakkerf518b162012-08-23 13:03:18 +000011 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +000012 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakkerf518b162012-08-23 13:03:18 +000013 *
Paul Bakkerf518b162012-08-23 13:03:18 +000014 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 */
28#ifndef POLARSSL_PBKDF2_H
29#define POLARSSL_PBKDF2_H
30
Paul Bakkerf518b162012-08-23 13:03:18 +000031#include "md.h"
32
Rich Evans00ab4702015-02-06 13:43:58 +000033#include <stddef.h>
34
Paul Bakkerfa6a6202013-10-28 18:48:30 +010035#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
Paul Bakker5c2364c2012-10-01 14:41:15 +000036#include <basetsd.h>
37typedef UINT32 uint32_t;
38#else
39#include <inttypes.h>
40#endif
41
Paul Bakkerf518b162012-08-23 13:03:18 +000042#define POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA -0x007C /**< Bad input parameters to function. */
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/**
49 * \brief PKCS#5 PBKDF2 using HMAC
Manuel Pégourié-Gonnard71432842015-03-20 16:19:35 +000050 *
51 * \deprecated Use pkcs5_pbkdf2_hmac() instead
Paul Bakkerf518b162012-08-23 13:03:18 +000052 *
53 * \param ctx Generic HMAC context
54 * \param password Password to use when generating key
55 * \param plen Length of password
56 * \param salt Salt to use when generating key
57 * \param slen Length of salt
58 * \param iteration_count Iteration count
59 * \param key_length Length of generated key
60 * \param output Generated key. Must be at least as big as key_length
61 *
Manuel Pégourié-Gonnardb4fe3cb2015-01-22 16:11:05 +000062 * \returns 0 on success, or a POLARSSL_ERR_xxx code if verification fails.
Paul Bakkerf518b162012-08-23 13:03:18 +000063 */
64int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
65 size_t plen, const unsigned char *salt, size_t slen,
66 unsigned int iteration_count,
Paul Bakker5c2364c2012-10-01 14:41:15 +000067 uint32_t key_length, unsigned char *output );
Paul Bakkerf518b162012-08-23 13:03:18 +000068
Paul Bakkerf518b162012-08-23 13:03:18 +000069/**
70 * \brief Checkup routine
Manuel Pégourié-Gonnard71432842015-03-20 16:19:35 +000071 *
72 * \deprecated Use pkcs5_self_test() instead
Paul Bakkerf518b162012-08-23 13:03:18 +000073 *
74 * \return 0 if successful, or 1 if the test failed
75 */
76int pbkdf2_self_test( int verbose );
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif /* pbkdf2.h */