26
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
* SUCH DAMAGE.
28
28
*
29
- * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.20 2005/07/11 15:07:59 tgl Exp $
29
+ * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.21 2005/07/18 17:09:01 tgl Exp $
30
30
*/
31
31
32
32
#include "postgres.h"
@@ -127,6 +127,7 @@ int_md5_free(PX_MD * h)
127
127
{
128
128
MD5_CTX * ctx = (MD5_CTX * )h -> p .ptr ;
129
129
130
+ memset (ctx ,0 ,sizeof (* ctx ));
130
131
px_free (ctx );
131
132
px_free (h );
132
133
}
@@ -174,6 +175,7 @@ int_sha1_free(PX_MD * h)
174
175
{
175
176
SHA1_CTX * ctx = (SHA1_CTX * )h -> p .ptr ;
176
177
178
+ memset (ctx ,0 ,sizeof (* ctx ));
177
179
px_free (ctx );
178
180
px_free (h );
179
181
}
@@ -221,6 +223,7 @@ int_sha256_free(PX_MD * h)
221
223
{
222
224
SHA256_CTX * ctx = (SHA256_CTX * )h -> p .ptr ;
223
225
226
+ memset (ctx ,0 ,sizeof (* ctx ));
224
227
px_free (ctx );
225
228
px_free (h );
226
229
}
@@ -267,6 +270,7 @@ int_sha384_free(PX_MD * h)
267
270
{
268
271
SHA384_CTX * ctx = (SHA384_CTX * )h -> p .ptr ;
269
272
273
+ memset (ctx ,0 ,sizeof (* ctx ));
270
274
px_free (ctx );
271
275
px_free (h );
272
276
}
@@ -314,6 +318,7 @@ int_sha512_free(PX_MD * h)
314
318
{
315
319
SHA512_CTX * ctx = (SHA512_CTX * )h -> p .ptr ;
316
320
321
+ memset (ctx ,0 ,sizeof (* ctx ));
317
322
px_free (ctx );
318
323
px_free (h );
319
324
}
@@ -326,6 +331,7 @@ init_md5(PX_MD * md)
326
331
MD5_CTX * ctx ;
327
332
328
333
ctx = px_alloc (sizeof (* ctx ));
334
+ memset (ctx ,0 ,sizeof (* ctx ));
329
335
330
336
md -> p .ptr = ctx ;
331
337
@@ -345,6 +351,7 @@ init_sha1(PX_MD * md)
345
351
SHA1_CTX * ctx ;
346
352
347
353
ctx = px_alloc (sizeof (* ctx ));
354
+ memset (ctx ,0 ,sizeof (* ctx ));
348
355
349
356
md -> p .ptr = ctx ;
350
357
@@ -364,6 +371,7 @@ init_sha256(PX_MD * md)
364
371
SHA256_CTX * ctx ;
365
372
366
373
ctx = px_alloc (sizeof (* ctx ));
374
+ memset (ctx ,0 ,sizeof (* ctx ));
367
375
368
376
md -> p .ptr = ctx ;
369
377
@@ -383,6 +391,7 @@ init_sha384(PX_MD * md)
383
391
SHA384_CTX * ctx ;
384
392
385
393
ctx = px_alloc (sizeof (* ctx ));
394
+ memset (ctx ,0 ,sizeof (* ctx ));
386
395
387
396
md -> p .ptr = ctx ;
388
397
@@ -402,6 +411,7 @@ init_sha512(PX_MD * md)
402
411
SHA512_CTX * ctx ;
403
412
404
413
ctx = px_alloc (sizeof (* ctx ));
414
+ memset (ctx ,0 ,sizeof (* ctx ));
405
415
406
416
md -> p .ptr = ctx ;
407
417
@@ -829,6 +839,7 @@ static void system_reseed(void)
829
839
fortuna_add_entropy (SYSTEM_ENTROPY ,buf ,n );
830
840
831
841
seed_time = t ;
842
+ memset (buf ,0 ,sizeof (buf ));
832
843
}
833
844
834
845
int