security/nss/cmd/signtool/signtool.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 #ifndef SIGNTOOL_H
michael@0 6 #define SIGNTOOL_H
michael@0 7
michael@0 8 #define DJN_TEST
michael@0 9
michael@0 10 #include <stdio.h>
michael@0 11 #include <string.h>
michael@0 12 #include <errno.h>
michael@0 13
michael@0 14 #include "prprf.h"
michael@0 15 #include "prio.h"
michael@0 16 #include "secutil.h"
michael@0 17 #include "ocsp.h"
michael@0 18 #include "jar.h"
michael@0 19 #include "jarfile.h"
michael@0 20 #include "secpkcs7.h"
michael@0 21 #include "pk11func.h"
michael@0 22 #include "secmod.h"
michael@0 23 #include "plhash.h"
michael@0 24 #include "nss.h"
michael@0 25
michael@0 26 #ifdef _UNIX
michael@0 27 #include <unistd.h>
michael@0 28 #endif
michael@0 29
michael@0 30 /**********************************************************************
michael@0 31 * General Defines
michael@0 32 */
michael@0 33 #define JAR_BASE_END JAR_BASE + 100
michael@0 34 #define ERRX (-1) /* the exit code used on failure */
michael@0 35 #define FNSIZE 256 /* the maximum length for filenames */
michael@0 36 #define MAX_RSA_KEY_SIZE 4096
michael@0 37 #define DEFAULT_RSA_KEY_SIZE 1024
michael@0 38 #define MANIFEST "manifest.mf"
michael@0 39 #define DEFAULT_X509_BASENAME "x509"
michael@0 40 #define DEFAULT_COMMON_NAME "Signtool " NSS_VERSION " Testing Certificate"
michael@0 41 #define CREATOR "Signtool (signtool " NSS_VERSION ")"
michael@0 42 #define BREAKAGE "PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT."
michael@0 43 #define MIN_COMPRESSION_LEVEL (-1)
michael@0 44 #define MAX_COMPRESSION_LEVEL 9
michael@0 45 #define DEFAULT_COMPRESSION_LEVEL (-1) /* zlib understands this to be default*/
michael@0 46 #define STDIN_BUF_SIZE 160
michael@0 47 #define PROGRAM_NAME "signtool"
michael@0 48 #define LONG_PROGRAM_NAME "Signing Tool"
michael@0 49 #define DEFAULT_BASE_NAME "zigbert"
michael@0 50 #define TMP_OUTPUT "signtool.tmp"
michael@0 51 #define XPI_TEXT "Creating XPI Compatible Archive"
michael@0 52
michael@0 53 /***************************************************************
michael@0 54 * Main Task Functions
michael@0 55 */
michael@0 56 int GenerateCert(char *nickname, int keysize, char *token);
michael@0 57 int ListCerts(char *key, int list_certs);
michael@0 58 int VerifyJar(char *filename);
michael@0 59 int SignArchive(char *tree, char *keyName, char *zip_file, int javascript,
michael@0 60 char *meta_file, char *install_script, int _optimize, PRBool recurse);
michael@0 61 int SignAllArc(char *jartree, char *keyName, int javascript, char *metafile,
michael@0 62 char *install_script, int optimize, PRBool recurse);
michael@0 63 int InlineJavaScript(char *dir, PRBool recurse);
michael@0 64 int JarWho(char *filename);
michael@0 65 void JarListModules(void);
michael@0 66
michael@0 67 /**************************************************************
michael@0 68 * Utility Functions
michael@0 69 */
michael@0 70 CERTCertDBHandle *OpenCertDB (PRBool readOnly);
michael@0 71
michael@0 72 int RemoveAllArc(char *tree);
michael@0 73 void VerifyCertDir(char *dir, char *keyName);
michael@0 74 int InitCrypto(char *cert_dir, PRBool readOnly);
michael@0 75 int foreach (char *dirname, char *prefix,
michael@0 76 int (*fn)(char *filename, char *dirname, char *basedir,char *base,void*arg),
michael@0 77 PRBool recurse, PRBool includeDirs, void *arg);
michael@0 78 void print_error (int i);
michael@0 79 void give_help (int status);
michael@0 80 const char* secErrorString(long code);
michael@0 81 void displayVerifyLog(CERTVerifyLog *log);
michael@0 82 void Usage (void);
michael@0 83 void LongUsage (void);
michael@0 84 char* chop(char*);
michael@0 85 void out_of_memory(void);
michael@0 86 void FatalError(char *msg);
michael@0 87 char* get_default_cert_dir(void);
michael@0 88 SECItem *password_hardcode(void *arg, void *handle);
michael@0 89 char* pk11_password_hardcode(PK11SlotInfo *slot, PRBool retry, void *arg);
michael@0 90 int rm_dash_r(char *path);
michael@0 91 char* pr_fgets(char *buf, int size, PRFileDesc *file);
michael@0 92
michael@0 93
michael@0 94 /*****************************************************************
michael@0 95 * Global Variables (*gag*)
michael@0 96 */
michael@0 97 extern char *password; /* the password passed in on the command line */
michael@0 98 extern PLHashTable *excludeDirs; /* directory entry to skip while recursing */
michael@0 99 extern int no_time;
michael@0 100 extern int xpi_arc;
michael@0 101 extern char *base; /* basename of ".rsa" and ".sf" files */
michael@0 102 extern long *mozilla_event_queue;
michael@0 103 extern char *progName; /* argv[0] */
michael@0 104 extern PLHashTable *extensions;/* only sign files with this extension */
michael@0 105 extern PRBool extensionsGiven;
michael@0 106 extern char *scriptdir;
michael@0 107 extern int compression_level;
michael@0 108 extern PRFileDesc *outputFD, *errorFD;
michael@0 109 extern int verbosity;
michael@0 110 extern int errorCount;
michael@0 111 extern int warningCount;
michael@0 112 extern secuPWData pwdata;
michael@0 113
michael@0 114 #endif /* SIGNTOOL_H */

mercurial