michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: /* michael@0: * This code defines the glue layer between softoken and the legacy DB library michael@0: */ michael@0: #include "sdb.h" michael@0: michael@0: /* michael@0: * function prototypes for the callbacks into softoken from the legacyDB michael@0: */ michael@0: michael@0: typedef SECStatus (*LGEncryptFunc)(PLArenaPool *arena, SDB *sdb, michael@0: SECItem *plainText, SECItem **cipherText); michael@0: typedef SECStatus (*LGDecryptFunc)(SDB *sdb, SECItem *cipherText, michael@0: SECItem **plainText); michael@0: michael@0: /* michael@0: * function prototypes for the exported functions. michael@0: */ michael@0: typedef CK_RV (*LGOpenFunc) (const char *dir, const char *certPrefix, michael@0: const char *keyPrefix, michael@0: int certVersion, int keyVersion, int flags, michael@0: SDB **certDB, SDB **keyDB); michael@0: typedef char ** (*LGReadSecmodFunc)(const char *appName, michael@0: const char *filename, michael@0: const char *dbname, char *params, PRBool rw); michael@0: typedef SECStatus (*LGReleaseSecmodFunc)(const char *appName, michael@0: const char *filename, michael@0: const char *dbname, char **params, PRBool rw); michael@0: typedef SECStatus (*LGDeleteSecmodFunc)(const char *appName, michael@0: const char *filename, michael@0: const char *dbname, char *params, PRBool rw); michael@0: typedef SECStatus (*LGAddSecmodFunc)(const char *appName, michael@0: const char *filename, michael@0: const char *dbname, char *params, PRBool rw); michael@0: typedef SECStatus (*LGShutdownFunc)(PRBool forked); michael@0: typedef void (*LGSetForkStateFunc)(PRBool); michael@0: typedef void (*LGSetCryptFunc)(LGEncryptFunc, LGDecryptFunc); michael@0: michael@0: /* michael@0: * Softoken Glue Functions michael@0: */ michael@0: CK_RV sftkdbCall_open(const char *dir, const char *certPrefix, michael@0: const char *keyPrefix, michael@0: int certVersion, int keyVersion, int flags, PRBool isFIPS, michael@0: SDB **certDB, SDB **keyDB); michael@0: char ** sftkdbCall_ReadSecmodDB(const char *appName, const char *filename, michael@0: const char *dbname, char *params, PRBool rw); michael@0: SECStatus sftkdbCall_ReleaseSecmodDBData(const char *appName, michael@0: const char *filename, const char *dbname, michael@0: char **moduleSpecList, PRBool rw); michael@0: SECStatus sftkdbCall_DeleteSecmodDB(const char *appName, michael@0: const char *filename, const char *dbname, michael@0: char *args, PRBool rw); michael@0: SECStatus sftkdbCall_AddSecmodDB(const char *appName, michael@0: const char *filename, const char *dbname, michael@0: char *module, PRBool rw); michael@0: CK_RV sftkdbCall_Shutdown(void); michael@0: