summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2hg <devnull@localhost>2001-08-02 00:35:52 +0000
committercvs2hg <devnull@localhost>2001-08-02 00:35:52 +0000
commit71ee8a5e06e1eed5bb7a1c22ae2c2db36667e784 (patch)
treeb52418edd716c902ddbc95d779a39132015d23c1
parent8f6db144d9edccc74e0d5d6ca25583dd7ae4c202 (diff)
downloadnss-hg-71ee8a5e06e1eed5bb7a1c22ae2c2db36667e784.tar.gz
fixup commit for tag 'NOIMG_20010801_TAG'NOIMG_20010801_TAG
-rw-r--r--security/nss/lib/certdb/certdb.c10
-rw-r--r--security/nss/lib/util/secasn1e.c32
2 files changed, 31 insertions, 11 deletions
diff --git a/security/nss/lib/certdb/certdb.c b/security/nss/lib/certdb/certdb.c
index 3d35b9673..8523033f9 100644
--- a/security/nss/lib/certdb/certdb.c
+++ b/security/nss/lib/certdb/certdb.c
@@ -899,7 +899,7 @@ CERT_GetCertTimes(CERTCertificate *c, int64 *notBefore, int64 *notAfter)
SECCertTimeValidity
CERT_CheckCertValidTimes(CERTCertificate *c, int64 t, PRBool allowOverride)
{
- int64 notBefore, notAfter, llPendingSlop;
+ PRTime notBefore, notAfter, llPendingSlop, tmp1;
SECStatus rv;
/* if cert is already marked OK, then don't bother to check */
@@ -914,6 +914,9 @@ CERT_CheckCertValidTimes(CERTCertificate *c, int64 t, PRBool allowOverride)
}
LL_I2L(llPendingSlop, pendingSlop);
+ /* convert to micro seconds */
+ LL_I2L(tmp1, PR_USEC_PER_SEC);
+ LL_MUL(llPendingSlop, llPendingSlop, tmp1);
LL_SUB(notBefore, notBefore, llPendingSlop);
if ( LL_CMP( t, <, notBefore ) ) {
PORT_SetError(SEC_ERROR_EXPIRED_CERTIFICATE);
@@ -956,7 +959,7 @@ SEC_GetCrlTimes(CERTCrl *date, int64 *notBefore, int64 *notAfter)
*/
SECCertTimeValidity
SEC_CheckCrlTimes(CERTCrl *crl, int64 t) {
- int64 notBefore, notAfter, llPendingSlop;
+ PRTime notBefore, notAfter, llPendingSlop, tmp1;
SECStatus rv;
rv = SEC_GetCrlTimes(crl, &notBefore, &notAfter);
@@ -966,6 +969,9 @@ SEC_CheckCrlTimes(CERTCrl *crl, int64 t) {
}
LL_I2L(llPendingSlop, pendingSlop);
+ /* convert to micro seconds */
+ LL_I2L(tmp1, PR_USEC_PER_SEC);
+ LL_MUL(llPendingSlop, llPendingSlop, tmp1);
LL_SUB(notBefore, notBefore, llPendingSlop);
if ( LL_CMP( t, <, notBefore ) ) {
return(secCertTimeNotValidYet);
diff --git a/security/nss/lib/util/secasn1e.c b/security/nss/lib/util/secasn1e.c
index bc1be4e47..cb91934bd 100644
--- a/security/nss/lib/util/secasn1e.c
+++ b/security/nss/lib/util/secasn1e.c
@@ -473,7 +473,7 @@ sec_asn1e_which_choice
static unsigned long
sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
- PRBool *noheaderp)
+ PRBool parentstreaming, PRBool *noheaderp)
{
unsigned long encode_kind, underlying_kind;
PRBool explicit, optional, universal, may_stream;
@@ -509,7 +509,8 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
src2 = (void *)((char *)src + theTemplate[indx].offset);
- return sec_asn1e_contents_length(&theTemplate[indx], src2, noheaderp);
+ return sec_asn1e_contents_length(&theTemplate[indx], src2, parentstreaming,
+ noheaderp);
}
if ((encode_kind & (SEC_ASN1_POINTER | SEC_ASN1_INLINE)) || !universal) {
@@ -544,7 +545,8 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
src = (char *)src + theTemplate->offset;
if (explicit) {
- len = sec_asn1e_contents_length (theTemplate, src, noheaderp);
+ len = sec_asn1e_contents_length (theTemplate, src, parentstreaming,
+ noheaderp);
if (len == 0 && optional) {
*noheaderp = PR_TRUE;
} else if (*noheaderp) {
@@ -593,7 +595,8 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
}
src2 = (void *)((char *)src - theTemplate->offset + theTemplate[indx].offset);
- len = sec_asn1e_contents_length(&theTemplate[indx], src2, noheaderp);
+ len = sec_asn1e_contents_length(&theTemplate[indx], src2, parentstreaming,
+ noheaderp);
} else
switch (underlying_kind) {
@@ -615,7 +618,9 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
for (; *group != NULL; group++) {
sub_src = (char *)(*group) + tmpt->offset;
- sub_len = sec_asn1e_contents_length (tmpt, sub_src, noheaderp);
+ sub_len = sec_asn1e_contents_length (tmpt, sub_src,
+ may_stream, noheaderp);
+
len += sub_len;
/*
* XXX The 1 below is the presumed length of the identifier;
@@ -637,7 +642,9 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
len = 0;
for (tmpt = theTemplate + 1; tmpt->kind; tmpt++) {
sub_src = (char *)src + tmpt->offset;
- sub_len = sec_asn1e_contents_length (tmpt, sub_src, noheaderp);
+ sub_len = sec_asn1e_contents_length (tmpt, sub_src,
+ may_stream, noheaderp);
+
len += sub_len;
/*
* XXX The 1 below is the presumed length of the identifier;
@@ -659,8 +666,13 @@ sec_asn1e_contents_length (const SEC_ASN1Template *theTemplate, void *src,
default:
len = ((SECItem *)src)->len;
- if (may_stream && len == 0)
- len = 1; /* if we're streaming, we may have a secitem w/len 0 as placeholder */
+ if (may_stream && len == 0 && parentstreaming)
+ len = 1; /* if we're streaming, we may have a
+ * secitem w/len 0 as placeholder.
+ * But if the caller says we're optional,
+ * then we're not streaming, so we don't
+ * need a placeholder.
+ */
break;
}
@@ -719,7 +731,9 @@ sec_asn1e_write_header (sec_asn1e_state *state)
* walk the data structure to calculate the entire contents length.
*/
contents_length = sec_asn1e_contents_length (state->theTemplate,
- state->src, &noheader);
+ state->src,
+ (state->parent) ? state->parent->may_stream : state->may_stream,
+ &noheader);
/*
* We might be told explicitly not to put out a header.
* But it can also be the case, via a pushed subtemplate, that