summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-11-15 18:25:24 +0000
committerjbj <devnull@localhost>2002-11-15 18:25:24 +0000
commit94f365ca99d55f693e4a62437f71282cff08c60d (patch)
treec221b49db42c26fa49ec85df4723af511caf17cd /db
parent5e12066479a49936f1a00a145c3262229a8cf8f0 (diff)
downloadlibrpm-tizen-94f365ca99d55f693e4a62437f71282cff08c60d.tar.gz
librpm-tizen-94f365ca99d55f693e4a62437f71282cff08c60d.tar.bz2
librpm-tizen-94f365ca99d55f693e4a62437f71282cff08c60d.zip
Apply patch.4.1.24.1:
1.Fix a bug which could cause database environment open to hang. This bug only affects encrypted Berkeley DB database environments, and the patch should only be applied to Berkeley DB releases including cryptographic support. CVS patchset: 5864 CVS date: 2002/11/15 18:25:24
Diffstat (limited to 'db')
-rw-r--r--db/crypto/mersenne/mt19937db.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/db/crypto/mersenne/mt19937db.c b/db/crypto/mersenne/mt19937db.c
index 07af61dc3..9a54ea67a 100644
--- a/db/crypto/mersenne/mt19937db.c
+++ b/db/crypto/mersenne/mt19937db.c
@@ -142,11 +142,10 @@ static unsigned long
__db_genrand(dbenv)
DB_ENV *dbenv;
{
- unsigned long i, s, y;
+ unsigned long y;
static unsigned long mag01[2]={0x0, MATRIX_A};
/* mag01[x] = x * MATRIX_A for x=0,1 */
- u_int32_t secs, usecs;
- u_int8_t mac[DB_MAC_KEY];
+ u_int32_t secs, seed, usecs;
/*
* We are called with the mt_mutexp locked
@@ -157,19 +156,15 @@ __db_genrand(dbenv)
if (dbenv->mti == N+1) { /* if sgenrand() has not been called, */
/*
* Seed the generator with the hashed time. The __db_mac
- * function returns a 20 byte value, but we can safely
- * just use the first 4 bytes for the seed.
+ * function will return 4 bytes if we don't send in a key.
*/
do {
if (__os_clock(dbenv, &secs, &usecs) != 0)
return (0); /* 0 is the only invalid return */
- __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL, mac);
- s = 0;
- for (i = 0; i < DB_MAC_KEY && s == 0;
- i += sizeof(unsigned long))
- s = mac[i];
- } while (s == 0);
- __db_sgenrand(s, dbenv->mt, &dbenv->mti);
+ __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL,
+ (u_int8_t *)&seed);
+ } while (seed == 0);
+ __db_sgenrand((long)seed, dbenv->mt, &dbenv->mti);
}
for (kk=0;kk<N-M;kk++) {