Bug 967153: Update to NSS 3.16 beta 2 (NSS_3_16_BETA2), r=me
authorBrian Smith <brian@briansmith.org>
Thu, 13 Feb 2014 16:43:27 -0800
changeset 168821 5d8fc2d51ec217853af4e817905584a4b90992d3
parent 168820 33b3248b4aa09fbaf85fdc5f4a72e67b0e79cdc9
child 168822 8cdaaf3da9f84ba309429aee968d2f55a905c63d
push id26219
push userbrian@briansmith.org
push dateSat, 15 Feb 2014 00:49:58 +0000
treeherdermozilla-central@8cdaaf3da9f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs967153
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 967153: Update to NSS 3.16 beta 2 (NSS_3_16_BETA2), r=me
security/nss/TAG-INFO
security/nss/cmd/atob/atob.c
security/nss/lib/smime/smime.def
--- a/security/nss/TAG-INFO
+++ b/security/nss/TAG-INFO
@@ -1,1 +1,1 @@
-NSS_3_16_BETA1
+NSS_3_16_BETA2
--- a/security/nss/cmd/atob/atob.c
+++ b/security/nss/cmd/atob/atob.c
@@ -30,44 +30,65 @@ output_binary (void *arg, const unsigned
     if (nb != size) {
 	PORT_SetError(SEC_ERROR_IO);
 	return -1;
     }
 
     return nb;
 }
 
+static PRBool
+isBase64Char(char c)
+{
+    return ((c >= 'A' && c <= 'Z')
+	    || (c >= 'a' && c <= 'z')
+	    || (c >= '0' && c <= '9')
+	    || c == '+'
+	    || c == '/'
+	    || c == '=');
+}
+
 static SECStatus
 decode_file(FILE *outFile, FILE *inFile)
 {
     NSSBase64Decoder *cx;
-    int nb;
     SECStatus status = SECFailure;
     char ibuf[4096];
+    const char *ptr;
 
     cx = NSSBase64Decoder_Create(output_binary, outFile);
     if (!cx) {
 	return -1;
     }
 
     for (;;) {
 	if (feof(inFile)) break;
-	nb = fread(ibuf, 1, sizeof(ibuf), inFile);
-	if (nb != sizeof(ibuf)) {
-	    if (nb == 0) {
-		if (ferror(inFile)) {
-		    PORT_SetError(SEC_ERROR_IO);
-		    goto loser;
-		}
-		/* eof */
-		break;
+	if (!fgets(ibuf, sizeof(ibuf), inFile)) {
+	    if (ferror(inFile)) {
+		PORT_SetError(SEC_ERROR_IO);
+		goto loser;
+	    }
+	    /* eof */
+	    break;
+	}
+	for (ptr = ibuf; *ptr; ++ptr) {
+	    char c = *ptr;
+	    if (c == '\n' || c == '\r') {
+		break; /* found end of line */
+	    }
+	    if (!isBase64Char(c)) {
+	      ptr = ibuf; /* ignore line */
+	      break;
 	    }
 	}
+	if (ibuf == ptr) {
+	    continue; /* skip empty or non-base64 line */
+	}
 
-	status = NSSBase64Decoder_Update(cx, ibuf, nb);
+	status = NSSBase64Decoder_Update(cx, ibuf, ptr-ibuf);
 	if (status != SECSuccess) goto loser;
     }
 
     return NSSBase64Decoder_Destroy(cx, PR_FALSE);
 
   loser:
     (void) NSSBase64Decoder_Destroy(cx, PR_TRUE);
     return status;
@@ -94,20 +115,21 @@ int main(int argc, char **argv)
     PLOptStatus status;
 
     inFile = 0;
     outFile = 0;
     progName = strrchr(argv[0], '/');
     progName = progName ? progName+1 : argv[0];
 
     /* Parse command line arguments */
-    optstate = PL_CreateOptState(argc, argv, "i:o:");
+    optstate = PL_CreateOptState(argc, argv, "?hi:o:");
     while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
 	switch (optstate->option) {
 	  case '?':
+	  case 'h':
 	    Usage(progName);
 	    break;
 
 	  case 'i':
 	    inFile = fopen(optstate->value, "r");
 	    if (!inFile) {
 		fprintf(stderr, "%s: unable to open \"%s\" for reading\n",
 			progName, optstate->value);
--- a/security/nss/lib/smime/smime.def
+++ b/security/nss/lib/smime/smime.def
@@ -268,8 +268,14 @@ NSSSMIME_GetVersion;
 ;+       *;
 ;+};
 ;+NSS_3.15 {    # NSS 3.15 release
 ;+    global:
 SEC_PKCS7VerifyDetachedSignatureAtTime;
 ;+    local:
 ;+       *;
 ;+};
+;+NSS_3.16 {    # NSS 3.16 release
+;+    global:
+NSS_CMSSignerInfo_Verify;
+;+    local:
+;+       *;
+;+};