Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* JAR internal routines */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nspr.h" |
michael@0 | 8 | #include "key.h" |
michael@0 | 9 | #include "base64.h" |
michael@0 | 10 | |
michael@0 | 11 | extern CERTCertDBHandle *JAR_open_database (void); |
michael@0 | 12 | |
michael@0 | 13 | extern int JAR_close_database (CERTCertDBHandle *certdb); |
michael@0 | 14 | |
michael@0 | 15 | extern int jar_close_key_database (void *keydb); |
michael@0 | 16 | |
michael@0 | 17 | extern void *jar_open_key_database (void); |
michael@0 | 18 | |
michael@0 | 19 | extern JAR_Signer *JAR_new_signer (void); |
michael@0 | 20 | |
michael@0 | 21 | extern void JAR_destroy_signer (JAR_Signer *signer); |
michael@0 | 22 | |
michael@0 | 23 | extern JAR_Signer *jar_get_signer (JAR *jar, char *basename); |
michael@0 | 24 | |
michael@0 | 25 | extern int |
michael@0 | 26 | jar_append(ZZList *list, int type, char *pathname, void *data, size_t size); |
michael@0 | 27 | |
michael@0 | 28 | /* Translate fopen mode arg to PR_Open flags and mode */ |
michael@0 | 29 | PRFileDesc* |
michael@0 | 30 | JAR_FOPEN_to_PR_Open(const char *name, const char *mode); |
michael@0 | 31 | |
michael@0 | 32 | #define ADDITEM(list,type,pathname,data,size) \ |
michael@0 | 33 | { \ |
michael@0 | 34 | int err = jar_append (list, type, pathname, data, size); \ |
michael@0 | 35 | if (err < 0) \ |
michael@0 | 36 | return err; \ |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | /* Here is some ugliness in the event it is necessary to link |
michael@0 | 40 | with NSPR 1.0 libraries, which do not include an FSEEK. It is |
michael@0 | 41 | difficult to fudge an FSEEK into 1.0 so we use stdio. */ |
michael@0 | 42 | |
michael@0 | 43 | /* nspr 2.0 suite */ |
michael@0 | 44 | #define JAR_FILE PRFileDesc * |
michael@0 | 45 | #define JAR_FOPEN(fn,mode) JAR_FOPEN_to_PR_Open(fn,mode) |
michael@0 | 46 | #define JAR_FCLOSE PR_Close |
michael@0 | 47 | #define JAR_FSEEK PR_Seek |
michael@0 | 48 | #define JAR_FREAD PR_Read |
michael@0 | 49 | #define JAR_FWRITE PR_Write |
michael@0 | 50 | |
michael@0 | 51 | int |
michael@0 | 52 | jar_create_pk7(CERTCertDBHandle *certdb, void *keydb, |
michael@0 | 53 | CERTCertificate *cert, char *password, JAR_FILE infp, |
michael@0 | 54 | JAR_FILE outfp); |
michael@0 | 55 |