security/nss/lib/softoken/lgglue.h
author Kai Engert <kaie@kuix.de>
Fri, 12 Jun 2015 11:10:17 +0200
changeset 280937 ab92f3c0291618bd2362dc47361e522973df8569
parent 143406 06e3d7e19a09e4d5ac0dfe923603e47a1674e190
child 331819 069c82269f815250c75242bb9e3bf0fc46a28eca
permissions -rw-r--r--
Bug 1174102 - Update to NSS 3.19.2, landing NSS_3_19_2_BETA1, r=nss-confcall

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* 
 * This code defines the glue layer between softoken and the legacy DB library
 */
#include "sdb.h"

/*
 * function prototypes for the callbacks into softoken from the legacyDB
 */

typedef SECStatus (*LGEncryptFunc)(PLArenaPool *arena, SDB *sdb,
				  SECItem *plainText, SECItem **cipherText);
typedef SECStatus (*LGDecryptFunc)(SDB *sdb, SECItem *cipherText, 
				   SECItem **plainText);

/*
 * function prototypes for the exported functions.
 */
typedef CK_RV (*LGOpenFunc) (const char *dir, const char *certPrefix, 
		const char *keyPrefix, 
		int certVersion, int keyVersion, int flags, 
		SDB **certDB, SDB **keyDB);
typedef char ** (*LGReadSecmodFunc)(const char *appName, 
			const char *filename, 
			const char *dbname, char *params, PRBool rw);
typedef SECStatus (*LGReleaseSecmodFunc)(const char *appName,
			const char *filename, 
			const char *dbname, char **params, PRBool rw);
typedef SECStatus (*LGDeleteSecmodFunc)(const char *appName,
			const char *filename, 
			const char *dbname, char *params, PRBool rw);
typedef SECStatus (*LGAddSecmodFunc)(const char *appName, 
			const char *filename, 
			const char *dbname, char *params, PRBool rw);
typedef SECStatus (*LGShutdownFunc)(PRBool forked);
typedef void (*LGSetForkStateFunc)(PRBool);
typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc);

/*
 * Softoken Glue Functions
 */
CK_RV sftkdbCall_open(const char *dir, const char *certPrefix, 
		const char *keyPrefix, 
		int certVersion, int keyVersion, int flags, PRBool isFIPS,
		SDB **certDB, SDB **keyDB);
char ** sftkdbCall_ReadSecmodDB(const char *appName, const char *filename, 
			const char *dbname, char *params, PRBool rw);
SECStatus sftkdbCall_ReleaseSecmodDBData(const char *appName, 
			const char *filename, const char *dbname, 
			char **moduleSpecList, PRBool rw);
SECStatus sftkdbCall_DeleteSecmodDB(const char *appName, 
		      const char *filename, const char *dbname, 
		      char *args, PRBool rw);
SECStatus sftkdbCall_AddSecmodDB(const char *appName, 
		   const char *filename, const char *dbname, 
		   char *module, PRBool rw);
CK_RV sftkdbCall_Shutdown(void);