[352] | 1 | /* pwdbased.h
|
---|
| 2 | *
|
---|
| 3 | * Copyright (C) 2006-2017 wolfSSL Inc.
|
---|
| 4 | *
|
---|
| 5 | * This file is part of wolfSSL.
|
---|
| 6 | *
|
---|
| 7 | * wolfSSL is free software; you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * wolfSSL is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with this program; if not, write to the Free Software
|
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 |
|
---|
| 23 | #ifndef WOLF_CRYPT_PWDBASED_H
|
---|
| 24 | #define WOLF_CRYPT_PWDBASED_H
|
---|
| 25 |
|
---|
| 26 | #include <wolfssl/wolfcrypt/types.h>
|
---|
| 27 |
|
---|
| 28 | #ifndef NO_PWDBASED
|
---|
| 29 |
|
---|
| 30 | #ifndef NO_MD5
|
---|
| 31 | #include <wolfssl/wolfcrypt/md5.h> /* for hash type */
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #include <wolfssl/wolfcrypt/sha.h>
|
---|
| 35 |
|
---|
| 36 | #ifdef __cplusplus
|
---|
| 37 | extern "C" {
|
---|
| 38 | #endif
|
---|
| 39 |
|
---|
| 40 | /*
|
---|
| 41 | * hashType renamed to typeH to avoid shadowing global declaration here:
|
---|
| 42 | * wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types
|
---|
| 43 | */
|
---|
| 44 | WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen,
|
---|
| 45 | const byte* salt, int sLen, int iterations, int kLen,
|
---|
| 46 | int typeH);
|
---|
| 47 | WOLFSSL_API int wc_PBKDF2(byte* output, const byte* passwd, int pLen,
|
---|
| 48 | const byte* salt, int sLen, int iterations, int kLen,
|
---|
| 49 | int typeH);
|
---|
| 50 | WOLFSSL_API int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int pLen,
|
---|
| 51 | const byte* salt, int sLen, int iterations,
|
---|
| 52 | int kLen, int typeH, int purpose);
|
---|
| 53 | WOLFSSL_API int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd,int passLen,
|
---|
| 54 | const byte* salt, int saltLen, int iterations, int kLen,
|
---|
| 55 | int hashType, int id, void* heap);
|
---|
| 56 |
|
---|
| 57 | #ifdef HAVE_SCRYPT
|
---|
| 58 | WOLFSSL_API int wc_scrypt(byte* output, const byte* passwd, int passLen,
|
---|
| 59 | const byte* salt, int saltLen, int cost,
|
---|
| 60 | int blockSize, int parallel, int dkLen);
|
---|
| 61 | #endif
|
---|
| 62 |
|
---|
| 63 | /* helper functions */
|
---|
| 64 | WOLFSSL_LOCAL int GetDigestSize(int typeH);
|
---|
| 65 | WOLFSSL_LOCAL int GetPKCS12HashSizes(int typeH, word32* v, word32* u);
|
---|
| 66 | WOLFSSL_LOCAL int DoPKCS12Hash(int typeH, byte* buffer, word32 totalLen,
|
---|
| 67 | byte* Ai, word32 u, int iterations);
|
---|
| 68 |
|
---|
| 69 |
|
---|
| 70 | #ifdef __cplusplus
|
---|
| 71 | } /* extern "C" */
|
---|
| 72 | #endif
|
---|
| 73 |
|
---|
| 74 | #endif /* NO_PWDBASED */
|
---|
| 75 | #endif /* WOLF_CRYPT_PWDBASED_H */
|
---|