Example program to test AES-GCM functionality. Used for a workshop

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pbkdf2.c Source File

pbkdf2.c

Go to the documentation of this file.
00001 /**
00002  * \file pbkdf2.c
00003  *
00004  * \brief Password-Based Key Derivation Function 2 (from PKCS#5)
00005  *        DEPRECATED: Use pkcs5.c instead
00006  *
00007  * \author Mathias Olsson <mathias@kompetensum.com>
00008  *
00009  *  Copyright (C) 2006-2012, Brainspark B.V.
00010  *
00011  *  This file is part of PolarSSL (http://www.polarssl.org)
00012  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
00013  *
00014  *  All rights reserved.
00015  *
00016  *  This program is free software; you can redistribute it and/or modify
00017  *  it under the terms of the GNU General Public License as published by
00018  *  the Free Software Foundation; either version 2 of the License, or
00019  *  (at your option) any later version.
00020  *
00021  *  This program is distributed in the hope that it will be useful,
00022  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *  GNU General Public License for more details.
00025  *
00026  *  You should have received a copy of the GNU General Public License along
00027  *  with this program; if not, write to the Free Software Foundation, Inc.,
00028  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00029  */
00030 /*
00031  * PBKDF2 is part of PKCS#5
00032  *
00033  * http://tools.ietf.org/html/rfc2898 (Specification)
00034  * http://tools.ietf.org/html/rfc6070 (Test vectors)
00035  */
00036 
00037 #if !defined(POLARSSL_CONFIG_FILE)
00038 #include "polarssl/config.h"
00039 #else
00040 #include POLARSSL_CONFIG_FILE
00041 #endif
00042 
00043 #if defined(POLARSSL_PBKDF2_C)
00044 
00045 #include "polarssl/pbkdf2.h"
00046 #include "polarssl/pkcs5.h"
00047 
00048 int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password, size_t plen,
00049                  const unsigned char *salt, size_t slen,
00050                  unsigned int iteration_count,
00051                  uint32_t key_length, unsigned char *output )
00052 {
00053     return pkcs5_pbkdf2_hmac( ctx, password, plen, salt, slen, iteration_count,
00054                               key_length, output );
00055 }
00056 
00057 #if defined(POLARSSL_SELF_TEST)
00058 int pbkdf2_self_test( int verbose )
00059 {
00060     return pkcs5_self_test( verbose );
00061 }
00062 #endif /* POLARSSL_SELF_TEST */
00063 
00064 #endif /* POLARSSL_PBKDF2_C */
00065 
00066