diff options
author | Brian Smith <bsmith@mozilla.com> | 2013-03-22 19:25:18 -0700 |
---|---|---|
committer | Brian Smith <bsmith@mozilla.com> | 2013-03-22 19:25:18 -0700 |
commit | 37ffceebadfe073d4a067359d317e54c52f3864b (patch) | |
tree | 38ed3bdddfe2a79209bcf2d9c42bd084fdb81a30 /cmd | |
parent | 4e9d4d785d3344b1cf91e232b322329e5280fd18 (diff) | |
download | nss-hg-37ffceebadfe073d4a067359d317e54c52f3864b.tar.gz |
Bug 854729: Add const to many certificate-related NSS functions, r=ryan.sleevi
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/lib/basicutil.c | 6 | ||||
-rw-r--r-- | cmd/lib/basicutil.h | 11 | ||||
-rw-r--r-- | cmd/lib/derprint.c | 26 | ||||
-rw-r--r-- | cmd/lib/secutil.c | 40 | ||||
-rw-r--r-- | cmd/lib/secutil.h | 26 | ||||
-rw-r--r-- | cmd/selfserv/selfserv.c | 4 | ||||
-rw-r--r-- | cmd/signtool/verify.c | 4 |
7 files changed, 63 insertions, 54 deletions
diff --git a/cmd/lib/basicutil.c b/cmd/lib/basicutil.c index d2e36ed53..d3858dbc2 100644 --- a/cmd/lib/basicutil.c +++ b/cmd/lib/basicutil.c @@ -26,7 +26,7 @@ #include "secoid.h" -extern long DER_GetInteger(SECItem *src); +extern long DER_GetInteger(const SECItem *src); static PRBool wrapEnabled = PR_TRUE; @@ -231,7 +231,7 @@ void SECU_Newline(FILE *out) } void -SECU_PrintAsHex(FILE *out, SECItem *data, const char *m, int level) +SECU_PrintAsHex(FILE *out, const SECItem *data, const char *m, int level) { unsigned i; int column; @@ -377,7 +377,7 @@ SECU_PrintBuf(FILE *out, const char *msg, const void *vp, int len) ** call SECU_PrintEncodedInteger(); */ void -SECU_PrintInteger(FILE *out, SECItem *i, char *m, int level) +SECU_PrintInteger(FILE *out, const SECItem *i, const char *m, int level) { int iv; diff --git a/cmd/lib/basicutil.h b/cmd/lib/basicutil.h index 972086fd3..b90fdf5cd 100644 --- a/cmd/lib/basicutil.h +++ b/cmd/lib/basicutil.h @@ -42,10 +42,12 @@ extern void SECU_Indent(FILE *out, int level); extern void SECU_Newline(FILE *out); /* Print integer value and hex */ -extern void SECU_PrintInteger(FILE *out, SECItem *i, char *m, int level); +extern void SECU_PrintInteger(FILE *out, const SECItem *i, const char *m, + int level); /* Print SECItem as hex */ -extern void SECU_PrintAsHex(FILE *out, SECItem *i, const char *m, int level); +extern void SECU_PrintAsHex(FILE *out, const SECItem *i, const char *m, + int level); /* dump a buffer in hex and ASCII */ extern void SECU_PrintBuf(FILE *out, const char *msg, const void *vp, int len); @@ -62,8 +64,9 @@ extern SECStatus SECU_PKCS11Init(PRBool readOnly); extern int SECU_PrintSignedData(FILE *out, SECItem *der, const char *m, int level, SECU_PPFunc inner); -extern void SECU_PrintString(FILE *out, SECItem *si, char *m, int level); -extern void SECU_PrintAny(FILE *out, SECItem *i, char *m, int level); +extern void SECU_PrintString(FILE *out, const SECItem *si, const char *m, + int level); +extern void SECU_PrintAny(FILE *out, const SECItem *i, const char *m, int level); extern void SECU_PrintPRandOSError(char *progName); diff --git a/cmd/lib/derprint.c b/cmd/lib/derprint.c index cee4600b5..b4eb0ffb4 100644 --- a/cmd/lib/derprint.c +++ b/cmd/lib/derprint.c @@ -15,7 +15,7 @@ extern int fflush(FILE *stream); static int prettyColumn = 0; static int -getInteger256(unsigned char *data, unsigned int nb) +getInteger256(const unsigned char *data, unsigned int nb) { int val; @@ -100,7 +100,7 @@ prettyPrintByte(FILE *out, unsigned char item, unsigned int level) } static int -prettyPrintLeaf(FILE *out, unsigned char *data, +prettyPrintLeaf(FILE *out, const unsigned char *data, unsigned int len, unsigned int lv) { unsigned int i; @@ -115,7 +115,7 @@ prettyPrintLeaf(FILE *out, unsigned char *data, } static int -prettyPrintStringStart(FILE *out, unsigned char *str, +prettyPrintStringStart(FILE *out, const unsigned char *str, unsigned int len, unsigned int level) { #define BUF_SIZE 100 @@ -147,7 +147,7 @@ prettyPrintStringStart(FILE *out, unsigned char *str, } static int -prettyPrintString(FILE *out, unsigned char *str, +prettyPrintString(FILE *out, const unsigned char *str, unsigned int len, unsigned int level, PRBool raw) { int rv; @@ -170,7 +170,7 @@ prettyPrintString(FILE *out, unsigned char *str, } static int -prettyPrintTime(FILE *out, unsigned char *str, +prettyPrintTime(FILE *out, const unsigned char *str, unsigned int len, unsigned int level, PRBool raw, PRBool utc) { SECItem time_item; @@ -180,7 +180,7 @@ prettyPrintTime(FILE *out, unsigned char *str, if (rv < 0) return rv; - time_item.data = str; + time_item.data = (unsigned char *)str; time_item.len = len; rv = fprintf(out, " ("); @@ -214,7 +214,7 @@ prettyPrintTime(FILE *out, unsigned char *str, } static int -prettyPrintObjectID(FILE *out, unsigned char *data, +prettyPrintObjectID(FILE *out, const unsigned char *data, unsigned int len, unsigned int level, PRBool raw) { SECOidData *oiddata; @@ -260,7 +260,7 @@ prettyPrintObjectID(FILE *out, unsigned char *data, /* * Now try to look it up and print a symbolic version. */ - oiditem.data = data; + oiditem.data = (unsigned char *)data; oiditem.len = len; oiddata = SECOID_FindOID(&oiditem); if (oiddata != NULL) { @@ -338,7 +338,7 @@ static char *prettyTagType [32] = { }; static int -prettyPrintTag(FILE *out, unsigned char *src, unsigned char *end, +prettyPrintTag(FILE *out, const unsigned char *src, const unsigned char *end, unsigned char *codep, unsigned int level, PRBool raw) { int rv; @@ -402,7 +402,7 @@ prettyPrintTag(FILE *out, unsigned char *src, unsigned char *end, } static int -prettyPrintLength(FILE *out, unsigned char *data, unsigned char *end, +prettyPrintLength(FILE *out, const unsigned char *data, const unsigned char *end, int *lenp, PRBool *indefinitep, unsigned int lv, PRBool raw) { unsigned char lbyte; @@ -480,12 +480,12 @@ prettyPrintLength(FILE *out, unsigned char *data, unsigned char *end, } static int -prettyPrintItem(FILE *out, unsigned char *data, unsigned char *end, +prettyPrintItem(FILE *out, const unsigned char *data, const unsigned char *end, unsigned int lv, PRBool raw) { int slen; int lenLen; - unsigned char *orig = data; + const unsigned char *orig = data; int rv; while (data < end) { @@ -577,7 +577,7 @@ prettyPrintItem(FILE *out, unsigned char *data, unsigned char *end, } SECStatus -DER_PrettyPrint(FILE *out, SECItem *it, PRBool raw) +DER_PrettyPrint(FILE *out, const SECItem *it, PRBool raw) { int rv; diff --git a/cmd/lib/secutil.c b/cmd/lib/secutil.c index cc62456cf..7885ccd86 100644 --- a/cmd/lib/secutil.c +++ b/cmd/lib/secutil.c @@ -618,7 +618,7 @@ secu_PrintRawString(FILE *out, SECItem *si, const char *m, int level) } void -SECU_PrintString(FILE *out, SECItem *si, char *m, int level) +SECU_PrintString(FILE *out, const SECItem *si, const char *m, int level) { SECItem my = *si; @@ -650,7 +650,7 @@ secu_PrintBoolean(FILE *out, SECItem *i, const char *m, int level) * otherwise just print the formatted time string only. */ static void -secu_PrintTime(FILE *out, int64 time, char *m, int level) +secu_PrintTime(FILE *out, const PRTime time, const char *m, int level) { PRExplodedTime printableTime; char *timeString; @@ -683,7 +683,7 @@ secu_PrintTime(FILE *out, int64 time, char *m, int level) * otherwise just print the formatted time string only. */ void -SECU_PrintUTCTime(FILE *out, SECItem *t, char *m, int level) +SECU_PrintUTCTime(FILE *out, const SECItem *t, const char *m, int level) { int64 time; SECStatus rv; @@ -701,7 +701,7 @@ SECU_PrintUTCTime(FILE *out, SECItem *t, char *m, int level) * afterward; otherwise just print the formatted time string only. */ void -SECU_PrintGeneralizedTime(FILE *out, SECItem *t, char *m, int level) +SECU_PrintGeneralizedTime(FILE *out, const SECItem *t, const char *m, int level) { int64 time; SECStatus rv; @@ -720,7 +720,7 @@ SECU_PrintGeneralizedTime(FILE *out, SECItem *t, char *m, int level) * afterward; otherwise just print the formatted time string only. */ void -SECU_PrintTimeChoice(FILE *out, SECItem *t, char *m, int level) +SECU_PrintTimeChoice(FILE *out, const SECItem *t, const char *m, int level) { switch (t->type) { case siUTCTime: @@ -739,8 +739,8 @@ SECU_PrintTimeChoice(FILE *out, SECItem *t, char *m, int level) /* This prints a SET or SEQUENCE */ -void -SECU_PrintSet(FILE *out, SECItem *t, char *m, int level) +static void +SECU_PrintSet(FILE *out, const SECItem *t, const char *m, int level) { int type = t->data[0] & SEC_ASN1_TAGNUM_MASK; int constructed = t->data[0] & SEC_ASN1_CONSTRUCTED; @@ -794,7 +794,7 @@ SECU_PrintSet(FILE *out, SECItem *t, char *m, int level) } static void -secu_PrintContextSpecific(FILE *out, SECItem *i, char *m, int level) +secu_PrintContextSpecific(FILE *out, const SECItem *i, const char *m, int level) { int type = i->data[0] & SEC_ASN1_TAGNUM_MASK; int constructed = i->data[0] & SEC_ASN1_CONSTRUCTED; @@ -825,7 +825,7 @@ secu_PrintContextSpecific(FILE *out, SECItem *i, char *m, int level) } static void -secu_PrintOctetString(FILE *out, SECItem *i, char *m, int level) +secu_PrintOctetString(FILE *out, const SECItem *i, const char *m, int level) { SECItem tmp = *i; if (SECSuccess == SECU_StripTagAndLength(&tmp)) @@ -833,7 +833,7 @@ secu_PrintOctetString(FILE *out, SECItem *i, char *m, int level) } static void -secu_PrintBitString(FILE *out, SECItem *i, char *m, int level) +secu_PrintBitString(FILE *out, const SECItem *i, const char *m, int level) { int unused_bits; SECItem tmp = *i; @@ -853,7 +853,7 @@ secu_PrintBitString(FILE *out, SECItem *i, char *m, int level) /* in a decoded bit string, the len member is a bit length. */ static void -secu_PrintDecodedBitString(FILE *out, SECItem *i, char *m, int level) +secu_PrintDecodedBitString(FILE *out, const SECItem *i, const char *m, int level) { int unused_bits; SECItem tmp = *i; @@ -872,7 +872,7 @@ secu_PrintDecodedBitString(FILE *out, SECItem *i, char *m, int level) /* Print a DER encoded Boolean */ void -SECU_PrintEncodedBoolean(FILE *out, SECItem *i, char *m, int level) +SECU_PrintEncodedBoolean(FILE *out, const SECItem *i, const char *m, int level) { SECItem my = *i; if (SECSuccess == SECU_StripTagAndLength(&my)) @@ -881,7 +881,7 @@ SECU_PrintEncodedBoolean(FILE *out, SECItem *i, char *m, int level) /* Print a DER encoded integer */ void -SECU_PrintEncodedInteger(FILE *out, SECItem *i, char *m, int level) +SECU_PrintEncodedInteger(FILE *out, const SECItem *i, const char *m, int level) { SECItem my = *i; if (SECSuccess == SECU_StripTagAndLength(&my)) @@ -890,7 +890,7 @@ SECU_PrintEncodedInteger(FILE *out, SECItem *i, char *m, int level) /* Print a DER encoded OID */ void -SECU_PrintEncodedObjectID(FILE *out, SECItem *i, char *m, int level) +SECU_PrintEncodedObjectID(FILE *out, const SECItem *i, const char *m, int level) { SECItem my = *i; if (SECSuccess == SECU_StripTagAndLength(&my)) @@ -898,7 +898,7 @@ SECU_PrintEncodedObjectID(FILE *out, SECItem *i, char *m, int level) } static void -secu_PrintBMPString(FILE *out, SECItem *i, char *m, int level) +secu_PrintBMPString(FILE *out, const SECItem *i, const char *m, int level) { unsigned char * s; unsigned char * d; @@ -932,7 +932,7 @@ loser: } static void -secu_PrintUniversalString(FILE *out, SECItem *i, char *m, int level) +secu_PrintUniversalString(FILE *out, const SECItem *i, const char *m, int level) { unsigned char * s; unsigned char * d; @@ -967,7 +967,7 @@ loser: } static void -secu_PrintUniversal(FILE *out, SECItem *i, char *m, int level) +secu_PrintUniversal(FILE *out, const SECItem *i, const char *m, int level) { switch (i->data[0] & SEC_ASN1_TAGNUM_MASK) { case SEC_ASN1_ENUMERATED: @@ -1023,7 +1023,7 @@ secu_PrintUniversal(FILE *out, SECItem *i, char *m, int level) } void -SECU_PrintAny(FILE *out, SECItem *i, char *m, int level) +SECU_PrintAny(FILE *out, const SECItem *i, const char *m, int level) { if ( i && i->len && i->data ) { switch (i->data[0] & SEC_ASN1_CLASS_MASK) { @@ -1051,7 +1051,7 @@ secu_PrintValidity(FILE *out, CERTValidity *v, char *m, int level) /* This function does NOT expect a DER type and length. */ SECOidTag -SECU_PrintObjectID(FILE *out, SECItem *oid, char *m, int level) +SECU_PrintObjectID(FILE *out, const SECItem *oid, const char *m, int level) { SECOidData *oiddata; char * oidString = NULL; @@ -2289,7 +2289,7 @@ loser: } int -SECU_PrintCertificate(FILE *out, SECItem *der, char *m, int level) +SECU_PrintCertificate(FILE *out, const SECItem *der, const char *m, int level) { PRArenaPool *arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE); CERTCertificate *c; diff --git a/cmd/lib/secutil.h b/cmd/lib/secutil.h index dc8c0324a..022a4d5a8 100644 --- a/cmd/lib/secutil.h +++ b/cmd/lib/secutil.h @@ -163,10 +163,12 @@ extern SECStatus SECU_ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii); /* Print integer value and hex */ -extern void SECU_PrintInteger(FILE *out, SECItem *i, char *m, int level); +extern void SECU_PrintInteger(FILE *out, const SECItem *i, const char *m, + int level); /* Print ObjectIdentifier symbolically */ -extern SECOidTag SECU_PrintObjectID(FILE *out, SECItem *oid, char *m, int level); +extern SECOidTag SECU_PrintObjectID(FILE *out, const SECItem *oid, + const char *m, int level); /* Print AlgorithmIdentifier symbolically */ extern void SECU_PrintAlgorithmID(FILE *out, SECAlgorithmID *a, char *m, @@ -177,22 +179,24 @@ extern void SECU_PrintAlgorithmID(FILE *out, SECAlgorithmID *a, char *m, * do indent formatting based on "level" and add a newline afterward; * otherwise just print the formatted time string only. */ -extern void SECU_PrintUTCTime(FILE *out, SECItem *t, char *m, int level); +extern void SECU_PrintUTCTime(FILE *out, const SECItem *t, const char *m, + int level); /* * Format and print the Generalized Time "t". If the tag message "m" * is not NULL, * do indent formatting based on "level" and add a newline * afterward; otherwise just print the formatted time string only. */ -extern void SECU_PrintGeneralizedTime(FILE *out, SECItem *t, char *m, - int level); +extern void SECU_PrintGeneralizedTime(FILE *out, const SECItem *t, + const char *m, int level); /* * Format and print the UTC or Generalized Time "t". If the tag message * "m" is not NULL, do indent formatting based on "level" and add a newline * afterward; otherwise just print the formatted time string only. */ -extern void SECU_PrintTimeChoice(FILE *out, SECItem *t, char *m, int level); +extern void SECU_PrintTimeChoice(FILE *out, const SECItem *t, const char *m, + int level); /* callback for listing certs through pkcs11 */ extern SECStatus SECU_PrintCertNickname(CERTCertListNode* cert, void *data); @@ -210,7 +214,8 @@ extern int SECU_PrintCertificateRequest(FILE *out, SECItem *der, char *m, int level); /* Dump contents of certificate */ -extern int SECU_PrintCertificate(FILE *out, SECItem *der, char *m, int level); +extern int SECU_PrintCertificate(FILE *out, const SECItem *der, const char *m, + int level); extern int SECU_PrintDumpDerIssuerAndSerial(FILE *out, SECItem *der, char *m, int level); @@ -265,8 +270,9 @@ extern int SECU_PrintCrl(FILE *out, SECItem *der, char *m, int level); extern void SECU_PrintCRLInfo(FILE *out, CERTCrl *crl, char *m, int level); -extern void SECU_PrintString(FILE *out, SECItem *si, char *m, int level); -extern void SECU_PrintAny(FILE *out, SECItem *i, char *m, int level); +extern void SECU_PrintString(FILE *out, const SECItem *si, const char *m, + int level); +extern void SECU_PrintAny(FILE *out, const SECItem *i, const char *m, int level); extern void SECU_PrintPolicy(FILE *out, SECItem *value, char *msg, int level); extern void SECU_PrintPrivKeyUsagePeriodExtension(FILE *out, SECItem *value, @@ -289,7 +295,7 @@ extern SECKEYLowPublicKey *SECU_ConvHighToLow(SECKEYPublicKey *pubHighKey); extern char *SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg); -extern SECStatus DER_PrettyPrint(FILE *out, SECItem *it, PRBool raw); +extern SECStatus DER_PrettyPrint(FILE *out, const SECItem *it, PRBool raw); extern char *SECU_SECModDBName(void); diff --git a/cmd/selfserv/selfserv.c b/cmd/selfserv/selfserv.c index e9d5dc3e2..29a9c5ffb 100644 --- a/cmd/selfserv/selfserv.c +++ b/cmd/selfserv/selfserv.c @@ -475,7 +475,7 @@ mySSLSNISocketConfig(PRFileDesc *fd, const SECItem *sniNameArr, PRInt32 i = 0; const SECItem *current = sniNameArr; const char **nameArr = (const char**)arg; - const secuPWData *pwdata; + secuPWData *pwdata; CERTCertificate * cert = NULL; SECKEYPrivateKey * privKey = NULL; @@ -1118,7 +1118,7 @@ makeSignedOCSPResponse(PRArenaPool *arena, ocspStaplingModeType osm, CERTCertificate *ca; PRTime now = PR_Now(); PRTime nextUpdate; - const secuPWData *pwdata; + secuPWData *pwdata; PORT_Assert(model_sock != NULL && cert != NULL); diff --git a/cmd/signtool/verify.c b/cmd/signtool/verify.c index d8f00b6bd..d6b430ee2 100644 --- a/cmd/signtool/verify.c +++ b/cmd/signtool/verify.c @@ -47,7 +47,7 @@ VerifyJar(char *filename) "\nNOTE -- \"%s\" archive DID NOT PASS crypto verification.\n", filename); if (status < 0) { - char *errtext; + const char *errtext; if (status >= JAR_BASE && status <= JAR_BASE_END) { errtext = JAR_get_error (status); @@ -278,7 +278,7 @@ JarWho(char *filename) filename); retval = -1; if (jar->valid < 0 || status != -1) { - char *errtext; + const char *errtext; if (status >= JAR_BASE && status <= JAR_BASE_END) { errtext = JAR_get_error (status); |