]> git.pld-linux.org Git - packages/db.git/blob - patch.4.1.24.1
- fixed optflags passing, release 5
[packages/db.git] / patch.4.1.24.1
1 *** crypto/mersenne/mt19937db.c 2002/03/27 04:31:10     1.8
2 --- crypto/mersenne/mt19937db.c 2002/09/17 19:43:30     1.9
3 ***************
4 *** 142,152 ****
5   __db_genrand(dbenv)
6         DB_ENV *dbenv;
7   {
8 !     unsigned long i, s, y;
9       static unsigned long mag01[2]={0x0, MATRIX_A};
10       /* mag01[x] = x * MATRIX_A  for x=0,1 */
11 !     u_int32_t secs, usecs;
12 !     u_int8_t mac[DB_MAC_KEY];
13   
14       /*
15        * We are called with the mt_mutexp locked
16 --- 142,151 ----
17   __db_genrand(dbenv)
18         DB_ENV *dbenv;
19   {
20 !     unsigned long y;
21       static unsigned long mag01[2]={0x0, MATRIX_A};
22       /* mag01[x] = x * MATRIX_A  for x=0,1 */
23 !     u_int32_t secs, seed, usecs;
24   
25       /*
26        * We are called with the mt_mutexp locked
27 ***************
28 *** 157,175 ****
29           if (dbenv->mti == N+1) {  /* if sgenrand() has not been called, */
30                 /*
31                  * Seed the generator with the hashed time.  The __db_mac
32 !                * function returns a 20 byte value, but we can safely
33 !                * just use the first 4 bytes for the seed.
34                  */
35                 do {
36                         if (__os_clock(dbenv, &secs, &usecs) != 0)
37                                 return (0); /* 0 is the only invalid return */
38 !                       __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL, mac);
39 !                       s = 0;
40 !                       for (i = 0; i < DB_MAC_KEY && s == 0;
41 !                           i += sizeof(unsigned long))
42 !                               s = mac[i];
43 !               } while (s == 0);
44 !               __db_sgenrand(s, dbenv->mt, &dbenv->mti); 
45         }
46   
47           for (kk=0;kk<N-M;kk++) {
48 --- 156,170 ----
49           if (dbenv->mti == N+1) {  /* if sgenrand() has not been called, */
50                 /*
51                  * Seed the generator with the hashed time.  The __db_mac
52 !                * function will return 4 bytes if we don't send in a key.
53                  */
54                 do {
55                         if (__os_clock(dbenv, &secs, &usecs) != 0)
56                                 return (0); /* 0 is the only invalid return */
57 !                       __db_chksum((u_int8_t *)&secs, sizeof(secs), NULL,
58 !                           (u_int8_t *)&seed);
59 !               } while (seed == 0);
60 !               __db_sgenrand((long)seed, dbenv->mt, &dbenv->mti); 
61         }
62   
63           for (kk=0;kk<N-M;kk++) {
This page took 0.051878 seconds and 3 git commands to generate.