Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file pbkdf2.c |
| 3 | * |
Manuel Pégourié-Gonnard | 7143284 | 2015-03-20 16:19:35 +0000 | [diff] [blame] | 4 | * \brief Compatibility wrappers for pkcs5.c |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 5 | * |
| 6 | * \author Mathias Olsson <mathias@kompetensum.com> |
| 7 | * |
Manuel Pégourié-Gonnard | a658a40 | 2015-01-23 09:45:19 +0000 | [diff] [blame] | 8 | * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 9 | * |
Manuel Pégourié-Gonnard | fe44643 | 2015-03-06 13:17:10 +0000 | [diff] [blame] | 10 | * This file is part of mbed TLS (https://tls.mbed.org) |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 11 | * |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along |
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 25 | */ |
| 26 | /* |
| 27 | * PBKDF2 is part of PKCS#5 |
| 28 | * |
| 29 | * http://tools.ietf.org/html/rfc2898 (Specification) |
| 30 | * http://tools.ietf.org/html/rfc6070 (Test vectors) |
| 31 | */ |
| 32 | |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 33 | #if !defined(POLARSSL_CONFIG_FILE) |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 34 | #include "polarssl/config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 35 | #else |
| 36 | #include POLARSSL_CONFIG_FILE |
| 37 | #endif |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 38 | |
| 39 | #if defined(POLARSSL_PBKDF2_C) |
| 40 | |
| 41 | #include "polarssl/pbkdf2.h" |
Paul Bakker | b0c19a4 | 2013-06-24 19:26:38 +0200 | [diff] [blame] | 42 | #include "polarssl/pkcs5.h" |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 43 | |
| 44 | int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password, size_t plen, |
| 45 | const unsigned char *salt, size_t slen, |
| 46 | unsigned int iteration_count, |
Paul Bakker | 5c2364c | 2012-10-01 14:41:15 +0000 | [diff] [blame] | 47 | uint32_t key_length, unsigned char *output ) |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 48 | { |
Paul Bakker | b0c19a4 | 2013-06-24 19:26:38 +0200 | [diff] [blame] | 49 | return pkcs5_pbkdf2_hmac( ctx, password, plen, salt, slen, iteration_count, |
| 50 | key_length, output ); |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 51 | } |
| 52 | |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 53 | #if defined(POLARSSL_SELF_TEST) |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 54 | int pbkdf2_self_test( int verbose ) |
| 55 | { |
Paul Bakker | b0c19a4 | 2013-06-24 19:26:38 +0200 | [diff] [blame] | 56 | return pkcs5_self_test( verbose ); |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 57 | } |
Paul Bakker | f518b16 | 2012-08-23 13:03:18 +0000 | [diff] [blame] | 58 | #endif /* POLARSSL_SELF_TEST */ |
| 59 | |
| 60 | #endif /* POLARSSL_PBKDF2_C */ |