1 | /* pwdbased.h
|
---|
2 | *
|
---|
3 | * Copyright (C) 2006-2015 wolfSSL Inc.
|
---|
4 | *
|
---|
5 | * This file is part of wolfSSL. (formerly known as CyaSSL)
|
---|
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-1301, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef WOLF_CRYPT_PWDBASED_H
|
---|
23 | #define WOLF_CRYPT_PWDBASED_H
|
---|
24 |
|
---|
25 | #include <wolfssl/wolfcrypt/types.h>
|
---|
26 |
|
---|
27 | #ifndef NO_PWDBASED
|
---|
28 |
|
---|
29 | #ifndef NO_MD5
|
---|
30 | #include <wolfssl/wolfcrypt/md5.h> /* for hash type */
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #include <wolfssl/wolfcrypt/sha.h>
|
---|
34 |
|
---|
35 | #ifdef __cplusplus
|
---|
36 | extern "C" {
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * hashType renamed to typeH to avoid shadowing global declation here:
|
---|
41 | * wolfssl/wolfcrypt/asn.h line 173 in enum Oid_Types
|
---|
42 | */
|
---|
43 | WOLFSSL_API int wc_PBKDF1(byte* output, const byte* passwd, int pLen,
|
---|
44 | const byte* salt, int sLen, int iterations, int kLen,
|
---|
45 | int typeH);
|
---|
46 | WOLFSSL_API int wc_PBKDF2(byte* output, const byte* passwd, int pLen,
|
---|
47 | const byte* salt, int sLen, int iterations, int kLen,
|
---|
48 | int typeH);
|
---|
49 | WOLFSSL_API int wc_PKCS12_PBKDF(byte* output, const byte* passwd, int pLen,
|
---|
50 | const byte* salt, int sLen, int iterations,
|
---|
51 | int kLen, int typeH, int purpose);
|
---|
52 |
|
---|
53 | /* helper functions */
|
---|
54 | WOLFSSL_LOCAL int GetDigestSize(int typeH);
|
---|
55 | WOLFSSL_LOCAL int GetPKCS12HashSizes(int typeH, word32* v, word32* u);
|
---|
56 | WOLFSSL_LOCAL int DoPKCS12Hash(int typeH, byte* buffer, word32 totalLen,
|
---|
57 | byte* Ai, word32 u, int iterations);
|
---|
58 |
|
---|
59 |
|
---|
60 | #ifdef __cplusplus
|
---|
61 | } /* extern "C" */
|
---|
62 | #endif
|
---|
63 |
|
---|
64 | #endif /* NO_PWDBASED */
|
---|
65 | #endif /* WOLF_CRYPT_PWDBASED_H */
|
---|