mozglue/android/NSSBridge.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mozglue/android/NSSBridge.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     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 +#ifndef NSSBridge_h
     1.9 +#define NSSBridge_h
    1.10 +
    1.11 +#include "nss.h"
    1.12 +#include "pk11func.h"
    1.13 +#include "pk11sdr.h"
    1.14 +#include "seccomon.h"
    1.15 +#include "secitem.h"
    1.16 +#include "secmodt.h"
    1.17 +
    1.18 +#include "prerror.h"
    1.19 +#include "plstr.h"
    1.20 +#include "prmem.h"
    1.21 +
    1.22 +#include <jni.h>
    1.23 +
    1.24 +int setup_nss_functions(void *nss_handle, void *nssutil_handle, void *plc_handle);
    1.25 +
    1.26 +#define NSS_WRAPPER(name, return_type, args...) \
    1.27 +typedef return_type (*name ## _t)(args);  \
    1.28 +extern name ## _t f_ ## name;
    1.29 +
    1.30 +NSS_WRAPPER(NSS_Initialize, SECStatus, const char*, const char*, const char*, const char*, uint32_t)
    1.31 +NSS_WRAPPER(NSS_Shutdown, void, void)
    1.32 +NSS_WRAPPER(PK11SDR_Encrypt, SECStatus, SECItem *, SECItem *, SECItem *, void *)
    1.33 +NSS_WRAPPER(PK11SDR_Decrypt, SECStatus, SECItem *, SECItem *, void *)
    1.34 +NSS_WRAPPER(SECITEM_ZfreeItem, void, SECItem*, PRBool)
    1.35 +NSS_WRAPPER(PR_ErrorToString, char *, PRErrorCode, PRLanguageCode)
    1.36 +NSS_WRAPPER(PR_GetError, PRErrorCode, void)
    1.37 +NSS_WRAPPER(PR_Free, PRErrorCode, char *)
    1.38 +NSS_WRAPPER(PL_Base64Encode, char*, const char*, uint32_t, char*)
    1.39 +NSS_WRAPPER(PL_Base64Decode, char*, const char*, uint32_t, char*)
    1.40 +NSS_WRAPPER(PL_strfree, void, char*)
    1.41 +NSS_WRAPPER(PK11_GetInternalKeySlot, PK11SlotInfo *, void)
    1.42 +NSS_WRAPPER(PK11_NeedUserInit, PRBool, PK11SlotInfo *)
    1.43 +NSS_WRAPPER(PK11_InitPin, SECStatus, PK11SlotInfo*, const char*, const char*)
    1.44 +
    1.45 +bool setPassword(PK11SlotInfo *slot);
    1.46 +SECStatus doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool doEncrypt);
    1.47 +SECStatus encode(const unsigned char *data, int32_t dataLen, char **_retval);
    1.48 +SECStatus decode(const char *data, unsigned char **result, int32_t * _retval);
    1.49 +#endif /* NSS_h */

mercurial