diff options
author | cvs2hg <devnull@localhost> | 2002-01-16 05:09:26 +0000 |
---|---|---|
committer | cvs2hg <devnull@localhost> | 2002-01-16 05:09:26 +0000 |
commit | 5a250784a35e65aa1beec00f5a0c36c3bc5eb69e (patch) | |
tree | 25f8782c33af46831418d365e6a353ddb8d837cf | |
parent | a3641bea894e8f6df1d95c835b64c8777fada2e1 (diff) | |
download | nss-hg-5a250784a35e65aa1beec00f5a0c36c3bc5eb69e.tar.gz |
fixup commit for branch 'MOZILLA_0_9_8_BRANCH'
-rw-r--r-- | dbm/src/Makefile.in | 12 | ||||
-rw-r--r-- | dbm/tests/Makefile.in | 4 | ||||
-rw-r--r-- | security/coreconf/Linux.mk | 5 | ||||
-rw-r--r-- | security/nss/lib/freebl/mpi/mpprime.c | 4 | ||||
-rw-r--r-- | security/nss/lib/freebl/rsa.c | 60 | ||||
-rw-r--r-- | security/nss/lib/nss/nss.h | 4 |
6 files changed, 63 insertions, 26 deletions
diff --git a/dbm/src/Makefile.in b/dbm/src/Makefile.in index 216faa439..d65e0f8e7 100644 --- a/dbm/src/Makefile.in +++ b/dbm/src/Makefile.in @@ -29,6 +29,10 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = mozdbm_s LIB_IS_C_ONLY = 1 +ifeq ($(OS_ARCH),WINNT) +LIBRARY_NAME = dbm$(MOZ_BITS) +endif + CSRCS = \ db.c \ h_bigkey.c \ @@ -44,13 +48,17 @@ CSRCS = \ nsres.c \ $(NULL) +ifeq ($(OS_ARCH),WINNT) +CSRCS += memmove.c snprintf.c +else ifeq (,$(filter -DHAVE_MEMMOVE=1,$(DEFS))) -CSRC += memmove.c +CSRCS += memmove.c endif ifeq (,$(filter -DHAVE_SNPRINTF=1,$(DEFS))) -CSRC += snprintf.c +CSRCS += snprintf.c endif +endif # WINNT LOCAL_INCLUDES = -I$(srcdir)/../include diff --git a/dbm/tests/Makefile.in b/dbm/tests/Makefile.in index 7ec5caabf..96cbdf8b5 100644 --- a/dbm/tests/Makefile.in +++ b/dbm/tests/Makefile.in @@ -31,7 +31,11 @@ PROGRAM = lots$(BIN_SUFFIX) CSRCS = lots.c +ifeq ($(OS_ARCH),WINNT) +EXTRA_DSO_LIBS = dbm$(MOZ_BITS) +else EXTRA_DSO_LIBS = mozdbm_s +endif LIBS = $(EXTRA_DSO_LIBS) diff --git a/security/coreconf/Linux.mk b/security/coreconf/Linux.mk index 026de2837..41e20b44c 100644 --- a/security/coreconf/Linux.mk +++ b/security/coreconf/Linux.mk @@ -50,6 +50,10 @@ RANLIB = ranlib DEFAULT_COMPILER = gcc +ifeq ($(OS_TEST),m68k) + OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE + CPU_ARCH = m68k +else ifeq ($(OS_TEST),ppc) OS_REL_CFLAGS = -DLINUX1_2 -D_XOPEN_SOURCE CPU_ARCH = ppc @@ -82,6 +86,7 @@ endif endif endif endif +endif LIBC_TAG = _glibc diff --git a/security/nss/lib/freebl/mpi/mpprime.c b/security/nss/lib/freebl/mpi/mpprime.c index 76a64a083..7317eeab1 100644 --- a/security/nss/lib/freebl/mpi/mpprime.c +++ b/security/nss/lib/freebl/mpi/mpprime.c @@ -427,7 +427,7 @@ mp_err mpp_make_prime(mp_int *start, mp_size nBits, mp_size strong, * Mac builds don't break by adding an extra variable * on the stack. -javi */ -#ifdef macintosh +#if defined(macintosh) || defined (XP_OS2) unsigned char *sieve; sieve = malloc(SIEVE_SIZE); @@ -569,7 +569,7 @@ CLEANUP: mp_clear(&q); if (nTries) *nTries += i; -#ifdef macintosh +#if defined(macintosh) || defined(XP_OS2) if (sieve != NULL) { memset(sieve, 0, SIEVE_SIZE); free (sieve); diff --git a/security/nss/lib/freebl/rsa.c b/security/nss/lib/freebl/rsa.c index 43d22383c..40903b34d 100644 --- a/security/nss/lib/freebl/rsa.c +++ b/security/nss/lib/freebl/rsa.c @@ -454,27 +454,27 @@ cleanup: static SECStatus rsa_PrivateKeyOpCRTCheckedPubKey(RSAPrivateKey *key, mp_int *m, mp_int *c) { - mp_int n, e, s; + mp_int n, e, v; mp_err err = MP_OKAY; SECStatus rv = SECSuccess; MP_DIGITS(&n) = 0; MP_DIGITS(&e) = 0; - MP_DIGITS(&s) = 0; + MP_DIGITS(&v) = 0; CHECK_MPI_OK( mp_init(&n) ); CHECK_MPI_OK( mp_init(&e) ); - CHECK_MPI_OK( mp_init(&s) ); + CHECK_MPI_OK( mp_init(&v) ); CHECK_SEC_OK( rsa_PrivateKeyOpCRTNoCheck(key, m, c) ); SECITEM_TO_MPINT(key->modulus, &n); SECITEM_TO_MPINT(key->publicExponent, &e); - /* Perform a public key operation c = m ** e mod n */ - CHECK_MPI_OK( mp_exptmod(m, &e, &n, &s) ); - if (mp_cmp(&s, c) != 0) { + /* Perform a public key operation v = m ** e mod n */ + CHECK_MPI_OK( mp_exptmod(m, &e, &n, &v) ); + if (mp_cmp(&v, c) != 0) { rv = SECFailure; } cleanup: mp_clear(&n); mp_clear(&e); - mp_clear(&s); + mp_clear(&v); if (err) { MP_TO_SEC_ERROR(err); rv = SECFailure; @@ -748,6 +748,29 @@ RSA_PrivateKeyOpDoubleChecked(RSAPrivateKey *key, return rsa_PrivateKeyOp(key, output, input, PR_TRUE); } +static SECStatus +swap_in_key_value(PRArenaPool *arena, mp_int *mpval, SECItem *buffer) +{ + int len; + mp_err err = MP_OKAY; + memset(buffer->data, 0, buffer->len); + len = mp_unsigned_octet_size(mpval); + if (len <= 0) return SECFailure; + if ((unsigned int)len <= buffer->len) { + /* The new value is no longer than the old buffer, so use it */ + err = mp_to_unsigned_octets(mpval, buffer->data, len); + buffer->len = len; + } else if (arena) { + /* The new value is longer, but working within an arena */ + (void)SECITEM_AllocItem(arena, buffer, len); + err = mp_to_unsigned_octets(mpval, buffer->data, len); + } else { + /* The new value is longer, no arena, can't handle this key */ + return SECFailure; + } + return (err == MP_OKAY) ? SECSuccess : SECFailure; +} + SECStatus RSA_PrivateKeyCheck(RSAPrivateKey *key) { @@ -784,15 +807,15 @@ RSA_PrivateKeyCheck(RSAPrivateKey *key) SECITEM_TO_MPINT(key->coefficient, &qInv); /* p > q */ if (mp_cmp(&p, &q) <= 0) { - /* mind the p's and q's */ + /* mind the p's and q's (and d_p's and d_q's) */ SECItem tmp; mp_exch(&p, &q); - tmp.data = key->prime1.data; - tmp.len = key->prime1.len; - key->prime1.data = key->prime2.data; - key->prime1.len = key->prime2.len; - key->prime2.data = tmp.data; - key->prime2.len = tmp.len; + tmp = key->prime1; + key->prime1 = key->prime2; + key->prime2 = tmp; + tmp = key->exponent1; + key->exponent1 = key->exponent2; + key->exponent2 = tmp; } #define VERIFY_MPI_EQUAL(m1, m2) \ if (mp_cmp(m1, m2) != 0) { \ @@ -831,23 +854,20 @@ RSA_PrivateKeyCheck(RSAPrivateKey *key) CHECK_MPI_OK( mp_mod(&d, &psub1, &res) ); if (mp_cmp(&d_p, &res) != 0) { /* swap in the correct value */ - SECITEM_ZfreeItem(&key->exponent1, PR_FALSE); - MPINT_TO_SECITEM(&res, &key->exponent1, key->arena); + CHECK_SEC_OK( swap_in_key_value(key->arena, &res, &key->exponent1) ); } /* d_q == d mod q-1 */ CHECK_MPI_OK( mp_mod(&d, &qsub1, &res) ); if (mp_cmp(&d_q, &res) != 0) { /* swap in the correct value */ - SECITEM_ZfreeItem(&key->exponent2, PR_FALSE); - MPINT_TO_SECITEM(&res, &key->exponent2, key->arena); + CHECK_SEC_OK( swap_in_key_value(key->arena, &res, &key->exponent2) ); } /* q * q**-1 == 1 mod p */ CHECK_MPI_OK( mp_mulmod(&q, &qInv, &p, &res) ); if (mp_cmp_d(&res, 1) != 0) { /* compute the correct value */ CHECK_MPI_OK( mp_invmod(&q, &p, &qInv) ); - SECITEM_ZfreeItem(&key->coefficient, PR_FALSE); - MPINT_TO_SECITEM(&res, &key->coefficient, key->arena); + CHECK_SEC_OK( swap_in_key_value(key->arena, &qInv, &key->coefficient) ); } cleanup: mp_clear(&n); diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h index 53f111e7f..dfb0f60f7 100644 --- a/security/nss/lib/nss/nss.h +++ b/security/nss/lib/nss/nss.h @@ -49,11 +49,11 @@ SEC_BEGIN_PROTOS * The format of the version string should be * "<major version>.<minor version>[.<patch level>] [<Beta>]" */ -#define NSS_VERSION "3.3.2 Beta" +#define NSS_VERSION "3.3.2" #define NSS_VMAJOR 3 #define NSS_VMINOR 3 #define NSS_VPATCH 2 -#define NSS_BETA PR_TRUE +#define NSS_BETA PR_FALSE /* |