security/nss/cmd/signtool/signtool.h

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

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

mercurial