Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / mozglue / android / NSSBridge.h
blob77bcd1172459d5c7e4811a2ead499c7cdd4b96c9
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 NSSBridge_h
6 #define NSSBridge_h
8 #include "nss.h"
9 #include "pk11func.h"
10 #include "pk11sdr.h"
11 #include "seccomon.h"
12 #include "secitem.h"
13 #include "secmodt.h"
15 #include "prerror.h"
16 #include "plstr.h"
17 #include "prmem.h"
19 #include <jni.h>
21 int setup_nss_functions(void *nss_handle, void *nssutil_handle, void *plc_handle);
23 #define NSS_WRAPPER(name, return_type, args...) \
24 typedef return_type (*name ## _t)(args); \
25 extern name ## _t f_ ## name;
27 NSS_WRAPPER(NSS_Initialize, SECStatus, const char*, const char*, const char*, const char*, uint32_t)
28 NSS_WRAPPER(NSS_Shutdown, void, void)
29 NSS_WRAPPER(PK11SDR_Encrypt, SECStatus, SECItem *, SECItem *, SECItem *, void *)
30 NSS_WRAPPER(PK11SDR_Decrypt, SECStatus, SECItem *, SECItem *, void *)
31 NSS_WRAPPER(SECITEM_ZfreeItem, void, SECItem*, PRBool)
32 NSS_WRAPPER(PR_ErrorToString, char *, PRErrorCode, PRLanguageCode)
33 NSS_WRAPPER(PR_GetError, PRErrorCode, void)
34 NSS_WRAPPER(PR_Free, PRErrorCode, char *)
35 NSS_WRAPPER(PL_Base64Encode, char*, const char*, uint32_t, char*)
36 NSS_WRAPPER(PL_Base64Decode, char*, const char*, uint32_t, char*)
37 NSS_WRAPPER(PL_strfree, void, char*)
38 NSS_WRAPPER(PK11_GetInternalKeySlot, PK11SlotInfo *, void)
39 NSS_WRAPPER(PK11_NeedUserInit, PRBool, PK11SlotInfo *)
40 NSS_WRAPPER(PK11_InitPin, SECStatus, PK11SlotInfo*, const char*, const char*)
42 bool setPassword(PK11SlotInfo *slot);
43 SECStatus doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool doEncrypt);
44 SECStatus encode(const unsigned char *data, int32_t dataLen, char **_retval);
45 SECStatus decode(const char *data, unsigned char **result, int32_t * _retval);
46 #endif /* NSS_h */