security/nss/cmd/signtool/signtool.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/cmd/signtool/signtool.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,114 @@
     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 SIGNTOOL_H
     1.9 +#define SIGNTOOL_H
    1.10 + 
    1.11 +#define DJN_TEST
    1.12 +
    1.13 +#include <stdio.h>
    1.14 +#include <string.h>
    1.15 +#include <errno.h>
    1.16 +
    1.17 +#include "prprf.h"
    1.18 +#include "prio.h"
    1.19 +#include "secutil.h"
    1.20 +#include "ocsp.h"
    1.21 +#include "jar.h"
    1.22 +#include "jarfile.h"
    1.23 +#include "secpkcs7.h"
    1.24 +#include "pk11func.h"
    1.25 +#include "secmod.h"
    1.26 +#include "plhash.h"
    1.27 +#include "nss.h"
    1.28 +
    1.29 +#ifdef _UNIX
    1.30 +#include <unistd.h> 
    1.31 +#endif
    1.32 +
    1.33 +/**********************************************************************
    1.34 + * General Defines
    1.35 + */
    1.36 +#define JAR_BASE_END JAR_BASE + 100
    1.37 +#define ERRX (-1)	/* the exit code used on failure */
    1.38 +#define FNSIZE 256	/* the maximum length for filenames */
    1.39 +#define MAX_RSA_KEY_SIZE 4096
    1.40 +#define DEFAULT_RSA_KEY_SIZE 1024
    1.41 +#define MANIFEST "manifest.mf"
    1.42 +#define DEFAULT_X509_BASENAME "x509"
    1.43 +#define DEFAULT_COMMON_NAME "Signtool " NSS_VERSION " Testing Certificate"
    1.44 +#define CREATOR  "Signtool (signtool " NSS_VERSION ")"
    1.45 +#define BREAKAGE "PLEASE DO NOT EDIT THIS FILE. YOU WILL BREAK IT."
    1.46 +#define MIN_COMPRESSION_LEVEL (-1)
    1.47 +#define MAX_COMPRESSION_LEVEL 9
    1.48 +#define DEFAULT_COMPRESSION_LEVEL (-1) /* zlib understands this to be default*/
    1.49 +#define STDIN_BUF_SIZE 160
    1.50 +#define PROGRAM_NAME	"signtool"
    1.51 +#define LONG_PROGRAM_NAME "Signing Tool"
    1.52 +#define DEFAULT_BASE_NAME "zigbert"
    1.53 +#define TMP_OUTPUT "signtool.tmp"
    1.54 +#define XPI_TEXT "Creating XPI Compatible Archive"
    1.55 +
    1.56 +/***************************************************************
    1.57 + * Main Task Functions
    1.58 + */
    1.59 +int GenerateCert(char *nickname, int keysize, char *token);
    1.60 +int ListCerts(char *key, int list_certs);
    1.61 +int VerifyJar(char *filename);
    1.62 +int SignArchive(char *tree, char *keyName, char *zip_file, int javascript,
    1.63 +	char *meta_file, char *install_script, int _optimize, PRBool recurse);
    1.64 +int SignAllArc(char *jartree, char *keyName, int javascript, char *metafile,
    1.65 +	char *install_script, int optimize, PRBool recurse);
    1.66 +int InlineJavaScript(char *dir, PRBool recurse);
    1.67 +int JarWho(char *filename);
    1.68 +void JarListModules(void);
    1.69 +
    1.70 +/**************************************************************
    1.71 + * Utility Functions
    1.72 + */
    1.73 +CERTCertDBHandle *OpenCertDB (PRBool readOnly);
    1.74 +
    1.75 +int RemoveAllArc(char *tree);
    1.76 +void VerifyCertDir(char *dir, char *keyName);
    1.77 +int InitCrypto(char *cert_dir, PRBool readOnly);
    1.78 +int foreach (char *dirname, char *prefix,
    1.79 +	int (*fn)(char *filename, char *dirname, char *basedir,char *base,void*arg),
    1.80 +	PRBool recurse, PRBool includeDirs, void *arg);
    1.81 +void print_error (int i);
    1.82 +void give_help (int status);
    1.83 +const char* secErrorString(long code);
    1.84 +void displayVerifyLog(CERTVerifyLog *log);
    1.85 +void Usage (void);
    1.86 +void LongUsage (void);
    1.87 +char* chop(char*);
    1.88 +void out_of_memory(void);
    1.89 +void FatalError(char *msg);
    1.90 +char* get_default_cert_dir(void);
    1.91 +SECItem *password_hardcode(void *arg, void *handle);
    1.92 +char* pk11_password_hardcode(PK11SlotInfo *slot, PRBool retry, void *arg);
    1.93 +int rm_dash_r(char *path);
    1.94 +char* pr_fgets(char *buf, int size, PRFileDesc *file);
    1.95 +
    1.96 +
    1.97 +/*****************************************************************
    1.98 + * Global Variables (*gag*)
    1.99 + */
   1.100 +extern char *password;	/* the password passed in on the command line */
   1.101 +extern PLHashTable *excludeDirs;  /* directory entry to skip while recursing */
   1.102 +extern int no_time;
   1.103 +extern int xpi_arc;
   1.104 +extern char *base;		/* basename of ".rsa" and ".sf" files */
   1.105 +extern long *mozilla_event_queue;
   1.106 +extern char *progName; /* argv[0] */
   1.107 +extern PLHashTable *extensions;/* only sign files with this extension */
   1.108 +extern PRBool extensionsGiven;
   1.109 +extern char *scriptdir;
   1.110 +extern int compression_level;
   1.111 +extern PRFileDesc *outputFD, *errorFD;
   1.112 +extern int verbosity;
   1.113 +extern int errorCount;
   1.114 +extern int warningCount;
   1.115 +extern secuPWData pwdata;
   1.116 +
   1.117 +#endif /* SIGNTOOL_H */

mercurial