/**
  * \file		pbkdf2.h
  *
  * \brief		PBKDF2 with HMAC-SHA-1 key derivation function
  *
  * \author		Dmitriy Dorogovtsev (d.dorogovtse@samsung.com)
  *
  * \version	1.0
  *
  * \date		Created May 18, 2012
  *
  * \par		In Samsung Ukraine R&D Center (SURC) under a contract between
  * \par		LLC "Samsung Electronics Ukraine Company" (Kiev, Ukraine) and
  * \par		"Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
  * \par		Copyright: (c) Samsung Electronics Co, Ltd 2012. All rights reserved.
  */

#ifndef PBKDF2_H
#define PBKDF2_H

#include <stdint.h>

#define MAX_SALT_SIZE			64
#define SHA256_HASH_LENGTH		32

#define PBKDF_NOERROR			0
#define PBKDF_ERR_SALT_SIZE		1
#define PBKDF_HMAC_ERR			2

/**
  * \brief	Password-based key derivation function algorithm with HMAC-SHA-1
  *
  * \param password		Master password for which a derivation is generated
  * \param passLength	Password length in bytes
  * \param salt			Salt value
  * \param saltLength	Salt length in bytes
  * \param key			Derived key. Must point to keyLength bytes of memory
  * \param keyLength	Key length in bytes
  * \param rounds		Amount of iterations for PBKDF2
  * \return				void
  */
int PBKDF2_HMAC_SHA256( const uint8_t* password, unsigned int passLength, const uint8_t* salt,
						 unsigned int saltLength, uint8_t* key, unsigned int keyLength,
						 unsigned int rounds );

#endif
