security/nss/lib/softoken/sftkdbti.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef SFTKDBTI_H
     6 #define SFTKDBTI_H 1
     8 /*
     9  * private defines
    10  */
    11 struct SFTKDBHandleStr {
    12     SDB   *db;
    13     PRInt32 ref;
    14     CK_OBJECT_HANDLE  type;
    15     SECItem passwordKey;
    16     SECItem *newKey;
    17     SECItem *oldKey;
    18     SECItem *updatePasswordKey;
    19     PZLock *passwordLock;
    20     SFTKDBHandle *peerDB;
    21     SDB   *update;
    22     char  *updateID;
    23     PRBool updateDBIsInit;
    24 };
    26 #define SFTK_KEYDB_TYPE 0x40000000
    27 #define SFTK_CERTDB_TYPE 0x00000000
    28 #define SFTK_OBJ_TYPE_MASK 0xc0000000
    29 #define SFTK_OBJ_ID_MASK (~SFTK_OBJ_TYPE_MASK)
    30 #define SFTK_TOKEN_TYPE 0x80000000
    32 /* the following is the number of id's to handle on the stack at a time,
    33  * it's not an upper limit of IDS that can be stored in the database */
    34 #define SFTK_MAX_IDS 10
    36 #define SFTK_GET_SDB(handle) \
    37 	((handle)->update ? (handle)->update : (handle)->db)
    39 SECStatus sftkdb_DecryptAttribute(SECItem *passKey, SECItem *cipherText,
    40 			SECItem **plainText);
    41 SECStatus sftkdb_EncryptAttribute(PLArenaPool *arena, SECItem *passKey,
    42 			SECItem *plainText, SECItem **cipherText);
    43 SECStatus sftkdb_SignAttribute(PLArenaPool *arena, SECItem *passKey,
    44 			CK_OBJECT_HANDLE objectID,
    45 			CK_ATTRIBUTE_TYPE attrType,
    46 			SECItem *plainText, SECItem **sigText);
    47 SECStatus sftkdb_VerifyAttribute(SECItem *passKey,
    48 			CK_OBJECT_HANDLE objectID,
    49 			CK_ATTRIBUTE_TYPE attrType,
    50 			SECItem *plainText, SECItem *sigText);
    52 void sftk_ULong2SDBULong(unsigned char *data, CK_ULONG value);
    53 CK_RV sftkdb_Update(SFTKDBHandle *handle, SECItem *key);
    54 CK_RV sftkdb_PutAttributeSignature(SFTKDBHandle *handle, 
    55 		SDB *keyTarget, CK_OBJECT_HANDLE objectID, 
    56 		CK_ATTRIBUTE_TYPE type, SECItem *signText);
    60 #endif

mercurial