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