summaryrefslogtreecommitdiffstats
path: root/security/nss/files/patch-crlgen.c
blob: 119ea98e84651741d272703fe7aa1cc4fe937af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
--- cmd/crlutil/crlgen.c	Mon Apr 11 22:24:14 2005
+++ cmd/crlutil/crlgen.c	Fri Jul 29 01:50:48 2005
@@ -53,46 +53,4 @@
 #include "crlgen.h"
 
-
-/* these reroutines were taken from secitem.c, which is supposed to
- * replace this file some day */
-/*
- * This is the hash function.  We simply XOR the encoded form with
- * itself in sizeof(PLHashNumber)-byte chunks.  Improving this
- * routine is left as an excercise for the more mathematically
- * inclined student.
- */
-PLHashNumber PR_CALLBACK
-SECITEM_Hash ( const void *key)
-{
-    const SECItem *item = (const SECItem *)key;
-    PLHashNumber rv = 0;
-
-    PRUint8 *data = (PRUint8 *)item->data;
-    PRUint32 i;
-    PRUint8 *rvc = (PRUint8 *)&rv;
-
-    for( i = 0; i < item->len; i++ ) {
-        rvc[ i % sizeof(rv) ] ^= *data;
-        data++;
-    }
-
-    return rv;
-}
-
-/*
- * This is the key-compare function.  It simply does a lexical
- * comparison on the item data.  This does not result in
- * quite the same ordering as the "sequence of numbers" order,
- * but heck it's only used internally by the hash table anyway.
- */
-PRIntn PR_CALLBACK
-SECITEM_HashCompare ( const void *k1, const void *k2)
-{
-    const SECItem *i1 = (const SECItem *)k1;
-    const SECItem *i2 = (const SECItem *)k2;
-
-    return SECITEM_ItemsAreEqual(i1,i2);
-}
-
 /* Destroys extHandle and data. data was create on heap.
  * extHandle creaded by CERT_StartCRLEntryExtensions. entry
@@ -513,5 +471,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "AddIssuerAltNames: insufficient number of arguments.\n");
         return SECFailure;
     }
@@ -575,5 +533,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "AddCrlNumber: insufficient number of arguments.\n");
         goto loser;
     }
@@ -725,5 +683,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum, 
-                          "insufficient number of arguments.\n");
+                          "%s: insufficient number of arguments.\n", extName);
     }
 
@@ -923,5 +881,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "SetNewRangeField: insufficient number of arguments.\n");
         return SECFailure;
     }
@@ -988,5 +946,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "SetTimeField: insufficient number of arguments.\n");
         return SECFailure;
     }
@@ -1024,5 +982,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum, 
-                          "insufficient number of arguments.\n");
+                          "AddExtension: insufficient number of arguments.\n");
         return SECFailure;
     }
@@ -1042,5 +1000,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "AddExtension(%s) insufficient number of arguments.\n", *extData);
         return SECFailure;
     }
@@ -1078,5 +1036,5 @@
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum,
-                          "insufficient number of arguments.\n");
+                          "AddCert(%s, %s) insufficient number of arguments.\n", certId, revocationDate);
         return SECFailure;
     }
@@ -1362,12 +1362,12 @@
     }
 
     if (extStr->extData == NULL) {
-        extStr->extData = PORT_ZAlloc(MAX_EXT_DATA_LENGTH);
+        extStr->extData = PORT_ZNewArray(char *, MAX_EXT_DATA_LENGTH);
         if (!extStr->extData) {
             return SECFailure;
         }
     }
-    if (extStr->nextUpdatedData > MAX_EXT_DATA_LENGTH) {
+    if (extStr->nextUpdatedData >= MAX_EXT_DATA_LENGTH) {
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
         crlgen_PrintError(crlGenData->parsedLineNum, 
                           "number of fields in extension "
@@ -1415,7 +1415,7 @@
               PORT_Free(crlGenData->certEntry);
               break;
           case CRLGEN_ADD_EXTENSION_CONTEXT:
-              if (crlGenData->extensionEntry->nextUpdatedData) {
+              if (crlGenData->extensionEntry->extData) {
                   int i = 0;
                   for (;i < crlGenData->extensionEntry->nextUpdatedData;i++)
                       PORT_Free(*(crlGenData->extensionEntry->extData + i));
OpenPOWER on IntegriCloud