wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pwdbased.h Source File

pwdbased.h

00001 /* pwdbased.h
00002  *
00003  * Copyright (C) 2006-2016 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 
00023 #ifndef WOLF_CRYPT_PWDBASED_H
00024 #define WOLF_CRYPT_PWDBASED_H
00025 
00026 #include <wolfssl/wolfcrypt/types.h>
00027 
00028 #ifndef NO_PWDBASED
00029 
00030 #ifndef NO_MD5
00031     #include <wolfssl/wolfcrypt/md5.h>       /* for hash type */
00032 #endif
00033 
00034 #include <wolfssl/wolfcrypt/sha.h>
00035 
00036 #ifdef __cplusplus
00037     extern "C" {
00038 #endif
00039 
00040 /*
00041  * hashType renamed to typeH to avoid shadowing global declaration here:
00042  * wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types
00043  */
00044 WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen,
00045                       const byte* salt, int sLen, int iterations, int kLen,
00046                       int typeH);
00047 WOLFSSL_API int wc_PBKDF2(byte* output, const byte* passwd, int pLen,
00048                       const byte* salt, int sLen, int iterations, int kLen,
00049                       int typeH);
00050 WOLFSSL_API int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int pLen,
00051                             const byte* salt, int sLen, int iterations,
00052                             int kLen, int typeH, int purpose);
00053 WOLFSSL_API int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd,int passLen,
00054                        const byte* salt, int saltLen, int iterations, int kLen,
00055                        int hashType, int id, void* heap);
00056 
00057 #ifdef HAVE_SCRYPT
00058 WOLFSSL_API int wc_scrypt(byte* output, const byte* passwd, int passLen,
00059                           const byte* salt, int saltLen, int cost,
00060                           int blockSize, int parallel, int dkLen);
00061 #endif
00062 
00063 /* helper functions */
00064 WOLFSSL_LOCAL int GetDigestSize(int typeH);
00065 WOLFSSL_LOCAL int GetPKCS12HashSizes(int typeH, word32* v, word32* u);
00066 WOLFSSL_LOCAL int DoPKCS12Hash(int typeH, byte* buffer, word32 totalLen,
00067                                byte* Ai, word32 u, int iterations);
00068 
00069 
00070 #ifdef __cplusplus
00071     } /* extern "C" */
00072 #endif
00073 
00074 #endif /* NO_PWDBASED */
00075 #endif /* WOLF_CRYPT_PWDBASED_H */
00076