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 | |
michael@0 | 5 | #ifndef SFTKDBTI_H |
michael@0 | 6 | #define SFTKDBTI_H 1 |
michael@0 | 7 | |
michael@0 | 8 | /* |
michael@0 | 9 | * private defines |
michael@0 | 10 | */ |
michael@0 | 11 | struct SFTKDBHandleStr { |
michael@0 | 12 | SDB *db; |
michael@0 | 13 | PRInt32 ref; |
michael@0 | 14 | CK_OBJECT_HANDLE type; |
michael@0 | 15 | SECItem passwordKey; |
michael@0 | 16 | SECItem *newKey; |
michael@0 | 17 | SECItem *oldKey; |
michael@0 | 18 | SECItem *updatePasswordKey; |
michael@0 | 19 | PZLock *passwordLock; |
michael@0 | 20 | SFTKDBHandle *peerDB; |
michael@0 | 21 | SDB *update; |
michael@0 | 22 | char *updateID; |
michael@0 | 23 | PRBool updateDBIsInit; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | #define SFTK_KEYDB_TYPE 0x40000000 |
michael@0 | 27 | #define SFTK_CERTDB_TYPE 0x00000000 |
michael@0 | 28 | #define SFTK_OBJ_TYPE_MASK 0xc0000000 |
michael@0 | 29 | #define SFTK_OBJ_ID_MASK (~SFTK_OBJ_TYPE_MASK) |
michael@0 | 30 | #define SFTK_TOKEN_TYPE 0x80000000 |
michael@0 | 31 | |
michael@0 | 32 | /* the following is the number of id's to handle on the stack at a time, |
michael@0 | 33 | * it's not an upper limit of IDS that can be stored in the database */ |
michael@0 | 34 | #define SFTK_MAX_IDS 10 |
michael@0 | 35 | |
michael@0 | 36 | #define SFTK_GET_SDB(handle) \ |
michael@0 | 37 | ((handle)->update ? (handle)->update : (handle)->db) |
michael@0 | 38 | |
michael@0 | 39 | SECStatus sftkdb_DecryptAttribute(SECItem *passKey, SECItem *cipherText, |
michael@0 | 40 | SECItem **plainText); |
michael@0 | 41 | SECStatus sftkdb_EncryptAttribute(PLArenaPool *arena, SECItem *passKey, |
michael@0 | 42 | SECItem *plainText, SECItem **cipherText); |
michael@0 | 43 | SECStatus sftkdb_SignAttribute(PLArenaPool *arena, SECItem *passKey, |
michael@0 | 44 | CK_OBJECT_HANDLE objectID, |
michael@0 | 45 | CK_ATTRIBUTE_TYPE attrType, |
michael@0 | 46 | SECItem *plainText, SECItem **sigText); |
michael@0 | 47 | SECStatus sftkdb_VerifyAttribute(SECItem *passKey, |
michael@0 | 48 | CK_OBJECT_HANDLE objectID, |
michael@0 | 49 | CK_ATTRIBUTE_TYPE attrType, |
michael@0 | 50 | SECItem *plainText, SECItem *sigText); |
michael@0 | 51 | |
michael@0 | 52 | void sftk_ULong2SDBULong(unsigned char *data, CK_ULONG value); |
michael@0 | 53 | CK_RV sftkdb_Update(SFTKDBHandle *handle, SECItem *key); |
michael@0 | 54 | CK_RV sftkdb_PutAttributeSignature(SFTKDBHandle *handle, |
michael@0 | 55 | SDB *keyTarget, CK_OBJECT_HANDLE objectID, |
michael@0 | 56 | CK_ATTRIBUTE_TYPE type, SECItem *signText); |
michael@0 | 57 | |
michael@0 | 58 | |
michael@0 | 59 | |
michael@0 | 60 | #endif |