security/nss/lib/softoken/sdb.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/softoken/sdb.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,78 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +/*
     1.8 + * This file implements PKCS 11 on top of our existing security modules
     1.9 + *
    1.10 + * For more information about PKCS 11 See PKCS 11 Token Inteface Standard.
    1.11 + *   This implementation has two slots:
    1.12 + *	slot 1 is our generic crypto support. It does not require login.
    1.13 + *   It supports Public Key ops, and all they bulk ciphers and hashes. 
    1.14 + *   It can also support Private Key ops for imported Private keys. It does 
    1.15 + *   not have any token storage.
    1.16 + *	slot 2 is our private key support. It requires a login before use. It
    1.17 + *   can store Private Keys and Certs as token objects. Currently only private
    1.18 + *   keys and their associated Certificates are saved on the token.
    1.19 + *
    1.20 + *   In this implementation, session objects are only visible to the session
    1.21 + *   that created or generated them.
    1.22 + */
    1.23 +
    1.24 +/*
    1.25 + * the following data structures should be moved to a 'rdb.h'.
    1.26 + */
    1.27 +
    1.28 +#ifndef _SDB_H
    1.29 +#define _SDB_H 1
    1.30 +#include "pkcs11t.h"
    1.31 +#include "secitem.h"
    1.32 +#include "sftkdbt.h"
    1.33 +
    1.34 +#define STATIC_CMD_SIZE 2048
    1.35 +
    1.36 +typedef struct SDBFindStr SDBFind;
    1.37 +typedef struct SDBStr SDB;
    1.38 +
    1.39 +struct SDBStr {
    1.40 +    void *private;
    1.41 +    int  version;
    1.42 +    int  reserved;
    1.43 +    int  sdb_flags;
    1.44 +    void *app_private;
    1.45 +    CK_RV (*sdb_FindObjectsInit)(SDB *sdb, const CK_ATTRIBUTE *template, 
    1.46 +				 CK_ULONG count, SDBFind **find);
    1.47 +    CK_RV (*sdb_FindObjects)(SDB *sdb, SDBFind *find, CK_OBJECT_HANDLE *ids, 
    1.48 +				CK_ULONG arraySize, CK_ULONG *count);
    1.49 +    CK_RV (*sdb_FindObjectsFinal)(SDB *sdb, SDBFind *find);
    1.50 +    CK_RV (*sdb_GetAttributeValue)(SDB *sdb, CK_OBJECT_HANDLE object, 
    1.51 +				CK_ATTRIBUTE *template, CK_ULONG count);
    1.52 +    CK_RV (*sdb_SetAttributeValue)(SDB *sdb, CK_OBJECT_HANDLE object, 
    1.53 +				const CK_ATTRIBUTE *template, CK_ULONG count);
    1.54 +    CK_RV (*sdb_CreateObject)(SDB *sdb, CK_OBJECT_HANDLE *object, 
    1.55 +				const CK_ATTRIBUTE *template, CK_ULONG count);
    1.56 +    CK_RV (*sdb_DestroyObject)(SDB *sdb, CK_OBJECT_HANDLE object);
    1.57 +    CK_RV (*sdb_GetMetaData)(SDB *sdb, const char *id, 
    1.58 +				SECItem *item1, SECItem *item2);
    1.59 +    CK_RV (*sdb_PutMetaData)(SDB *sdb, const char *id,
    1.60 +				const SECItem *item1, const SECItem *item2);
    1.61 +    CK_RV (*sdb_Begin)(SDB *sdb);
    1.62 +    CK_RV (*sdb_Commit)(SDB *sdb);
    1.63 +    CK_RV (*sdb_Abort)(SDB *sdb);
    1.64 +    CK_RV (*sdb_Reset)(SDB *sdb);
    1.65 +    CK_RV (*sdb_Close)(SDB *sdb);
    1.66 +    void (*sdb_SetForkState)(PRBool forked);
    1.67 +};
    1.68 +
    1.69 +CK_RV s_open(const char *directory, const char *certPrefix, 
    1.70 +	     const char *keyPrefix,
    1.71 +	     int cert_version, int key_version, 
    1.72 +	     int flags, SDB **certdb, SDB **keydb, int *newInit);
    1.73 +CK_RV s_shutdown();
    1.74 +
    1.75 +/* flags */
    1.76 +#define SDB_RDONLY      1
    1.77 +#define SDB_RDWR        2
    1.78 +#define SDB_CREATE      4
    1.79 +#define SDB_HAS_META    8
    1.80 +
    1.81 +#endif

mercurial