Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | #ifndef _SECPKCS5_H_ |
michael@0 | 5 | #define _SECPKCS5_H_ |
michael@0 | 6 | #include "seccomon.h" |
michael@0 | 7 | #include "secmodt.h" |
michael@0 | 8 | |
michael@0 | 9 | /* used for V2 PKCS 12 Draft Spec */ |
michael@0 | 10 | typedef enum { |
michael@0 | 11 | pbeBitGenIDNull = 0, |
michael@0 | 12 | pbeBitGenCipherKey = 0x01, |
michael@0 | 13 | pbeBitGenCipherIV = 0x02, |
michael@0 | 14 | pbeBitGenIntegrityKey = 0x03 |
michael@0 | 15 | } PBEBitGenID; |
michael@0 | 16 | |
michael@0 | 17 | typedef struct PBEBitGenContextStr PBEBitGenContext; |
michael@0 | 18 | |
michael@0 | 19 | SEC_BEGIN_PROTOS |
michael@0 | 20 | |
michael@0 | 21 | /* private */ |
michael@0 | 22 | SECAlgorithmID * |
michael@0 | 23 | sec_pkcs5CreateAlgorithmID(SECOidTag algorithm, SECOidTag cipherAlgorithm, |
michael@0 | 24 | SECOidTag prfAlg, SECOidTag *pPbeAlgorithm, |
michael@0 | 25 | int keyLengh, SECItem *salt, int iteration); |
michael@0 | 26 | |
michael@0 | 27 | /* Get the initialization vector. The password is passed in, hashing |
michael@0 | 28 | * is performed, and the initialization vector is returned. |
michael@0 | 29 | * algid is a pointer to a PBE algorithm ID |
michael@0 | 30 | * pwitem is the password |
michael@0 | 31 | * If an error occurs or the algorithm id is not a PBE algrithm, |
michael@0 | 32 | * NULL is returned. Otherwise, the iv is returned in a secitem. |
michael@0 | 33 | */ |
michael@0 | 34 | SECItem * |
michael@0 | 35 | SEC_PKCS5GetIV(SECAlgorithmID *algid, SECItem *pwitem, PRBool faulty3DES); |
michael@0 | 36 | |
michael@0 | 37 | SECOidTag SEC_PKCS5GetCryptoAlgorithm(SECAlgorithmID *algid); |
michael@0 | 38 | PRBool SEC_PKCS5IsAlgorithmPBEAlg(SECAlgorithmID *algid); |
michael@0 | 39 | PRBool SEC_PKCS5IsAlgorithmPBEAlgTag(SECOidTag algTag); |
michael@0 | 40 | SECOidTag SEC_PKCS5GetPBEAlgorithm(SECOidTag algTag, int keyLen); |
michael@0 | 41 | int SEC_PKCS5GetKeyLength(SECAlgorithmID *algid); |
michael@0 | 42 | |
michael@0 | 43 | /********************************************************************** |
michael@0 | 44 | * Deprecated PBE functions. Use the PBE functions in pk11func.h |
michael@0 | 45 | * instead. |
michael@0 | 46 | **********************************************************************/ |
michael@0 | 47 | |
michael@0 | 48 | PBEBitGenContext * |
michael@0 | 49 | PBE_CreateContext(SECOidTag hashAlgorithm, PBEBitGenID bitGenPurpose, |
michael@0 | 50 | SECItem *pwitem, SECItem *salt, unsigned int bitsNeeded, |
michael@0 | 51 | unsigned int iterations); |
michael@0 | 52 | |
michael@0 | 53 | void |
michael@0 | 54 | PBE_DestroyContext(PBEBitGenContext *context); |
michael@0 | 55 | |
michael@0 | 56 | |
michael@0 | 57 | SECItem * |
michael@0 | 58 | PBE_GenerateBits(PBEBitGenContext *context); |
michael@0 | 59 | |
michael@0 | 60 | SEC_END_PROTOS |
michael@0 | 61 | |
michael@0 | 62 | #endif /* _SECPKS5_H_ */ |