mbed TLS library
Dependents: HTTPClient-SSL WS_SERVER
polarssl/pbkdf2.c@0:137634ff4186, 2015-06-11 (annotated)
- Committer:
- ansond
- Date:
- Thu Jun 11 03:27:03 2015 +0000
- Revision:
- 0:137634ff4186
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:137634ff4186 | 1 | /** |
ansond | 0:137634ff4186 | 2 | * \file pbkdf2.c |
ansond | 0:137634ff4186 | 3 | * |
ansond | 0:137634ff4186 | 4 | * \brief Compatibility wrappers for pkcs5.c |
ansond | 0:137634ff4186 | 5 | * |
ansond | 0:137634ff4186 | 6 | * \author Mathias Olsson <mathias@kompetensum.com> |
ansond | 0:137634ff4186 | 7 | * |
ansond | 0:137634ff4186 | 8 | * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved |
ansond | 0:137634ff4186 | 9 | * |
ansond | 0:137634ff4186 | 10 | * This file is part of mbed TLS (https://tls.mbed.org) |
ansond | 0:137634ff4186 | 11 | * |
ansond | 0:137634ff4186 | 12 | * This program is free software; you can redistribute it and/or modify |
ansond | 0:137634ff4186 | 13 | * it under the terms of the GNU General Public License as published by |
ansond | 0:137634ff4186 | 14 | * the Free Software Foundation; either version 2 of the License, or |
ansond | 0:137634ff4186 | 15 | * (at your option) any later version. |
ansond | 0:137634ff4186 | 16 | * |
ansond | 0:137634ff4186 | 17 | * This program is distributed in the hope that it will be useful, |
ansond | 0:137634ff4186 | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ansond | 0:137634ff4186 | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ansond | 0:137634ff4186 | 20 | * GNU General Public License for more details. |
ansond | 0:137634ff4186 | 21 | * |
ansond | 0:137634ff4186 | 22 | * You should have received a copy of the GNU General Public License along |
ansond | 0:137634ff4186 | 23 | * with this program; if not, write to the Free Software Foundation, Inc., |
ansond | 0:137634ff4186 | 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
ansond | 0:137634ff4186 | 25 | */ |
ansond | 0:137634ff4186 | 26 | /* |
ansond | 0:137634ff4186 | 27 | * PBKDF2 is part of PKCS#5 |
ansond | 0:137634ff4186 | 28 | * |
ansond | 0:137634ff4186 | 29 | * http://tools.ietf.org/html/rfc2898 (Specification) |
ansond | 0:137634ff4186 | 30 | * http://tools.ietf.org/html/rfc6070 (Test vectors) |
ansond | 0:137634ff4186 | 31 | */ |
ansond | 0:137634ff4186 | 32 | |
ansond | 0:137634ff4186 | 33 | #if !defined(POLARSSL_CONFIG_FILE) |
ansond | 0:137634ff4186 | 34 | #include "polarssl/config.h" |
ansond | 0:137634ff4186 | 35 | #else |
ansond | 0:137634ff4186 | 36 | #include POLARSSL_CONFIG_FILE |
ansond | 0:137634ff4186 | 37 | #endif |
ansond | 0:137634ff4186 | 38 | |
ansond | 0:137634ff4186 | 39 | #if defined(POLARSSL_PBKDF2_C) |
ansond | 0:137634ff4186 | 40 | |
ansond | 0:137634ff4186 | 41 | #include "polarssl/pbkdf2.h" |
ansond | 0:137634ff4186 | 42 | #include "polarssl/pkcs5.h" |
ansond | 0:137634ff4186 | 43 | |
ansond | 0:137634ff4186 | 44 | #if ! defined(POLARSSL_DEPRECATED_REMOVED) |
ansond | 0:137634ff4186 | 45 | int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password, size_t plen, |
ansond | 0:137634ff4186 | 46 | const unsigned char *salt, size_t slen, |
ansond | 0:137634ff4186 | 47 | unsigned int iteration_count, |
ansond | 0:137634ff4186 | 48 | uint32_t key_length, unsigned char *output ) |
ansond | 0:137634ff4186 | 49 | { |
ansond | 0:137634ff4186 | 50 | return pkcs5_pbkdf2_hmac( ctx, password, plen, salt, slen, iteration_count, |
ansond | 0:137634ff4186 | 51 | key_length, output ); |
ansond | 0:137634ff4186 | 52 | } |
ansond | 0:137634ff4186 | 53 | #endif |
ansond | 0:137634ff4186 | 54 | |
ansond | 0:137634ff4186 | 55 | #if defined(POLARSSL_SELF_TEST) |
ansond | 0:137634ff4186 | 56 | #if ! defined(POLARSSL_DEPRECATED_REMOVED) |
ansond | 0:137634ff4186 | 57 | int pbkdf2_self_test( int verbose ) |
ansond | 0:137634ff4186 | 58 | { |
ansond | 0:137634ff4186 | 59 | return pkcs5_self_test( verbose ); |
ansond | 0:137634ff4186 | 60 | } |
ansond | 0:137634ff4186 | 61 | #endif |
ansond | 0:137634ff4186 | 62 | #endif /* POLARSSL_SELF_TEST */ |
ansond | 0:137634ff4186 | 63 | |
ansond | 0:137634ff4186 | 64 | #endif /* POLARSSL_PBKDF2_C */ |
ansond | 0:137634ff4186 | 65 |