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.h Source File

pbkdf2.h

Go to the documentation of this file.
00001 /**
00002  * \file pbkdf2.h
00003  *
00004  * \brief Password-Based Key Derivation Function 2 (from PKCS#5)
00005  *        DEPRECATED: use pkcs5.h 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 #ifndef POLARSSL_PBKDF2_H
00031 #define POLARSSL_PBKDF2_H
00032 
00033 #include <string.h>
00034 
00035 #include "md.h"
00036 
00037 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
00038 #include <basetsd.h>
00039 typedef UINT32 uint32_t;
00040 #else
00041 #include <inttypes.h>
00042 #endif
00043 
00044 #define POLARSSL_ERR_PBKDF2_BAD_INPUT_DATA                 -0x007C  /**< Bad input parameters to function. */
00045 
00046 #ifdef __cplusplus
00047 extern "C" {
00048 #endif
00049 
00050 /**
00051  * \brief          PKCS#5 PBKDF2 using HMAC
00052  *                 DEPRECATED: Use pkcs5_pbkdf2_hmac() instead!
00053  *
00054  * \param ctx      Generic HMAC context
00055  * \param password Password to use when generating key
00056  * \param plen     Length of password
00057  * \param salt     Salt to use when generating key
00058  * \param slen     Length of salt
00059  * \param iteration_count       Iteration count
00060  * \param key_length            Length of generated key
00061  * \param output   Generated key. Must be at least as big as key_length
00062  *
00063  * \returns        0 on success, or a PolarSSL error code if verification fails.
00064  */
00065 int pbkdf2_hmac( md_context_t *ctx, const unsigned char *password,
00066                  size_t plen, const unsigned char *salt, size_t slen,
00067                  unsigned int iteration_count,
00068                  uint32_t key_length, unsigned char *output );
00069 
00070 /**
00071  * \brief          Checkup routine
00072  *                 DEPRECATED: Use pkcs5_self_test() instead!
00073  *
00074  * \return         0 if successful, or 1 if the test failed
00075  */
00076 int pbkdf2_self_test( int verbose );
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif /* pbkdf2.h */
00083 
00084