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