projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Anderson and Biham's Tiger hash function added.
[u/mdw/catacomb]
/
dsarand.c
diff --git
a/dsarand.c
b/dsarand.c
index
fd54b6d
..
146a20f
100644
(file)
--- a/
dsarand.c
+++ b/
dsarand.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: dsarand.c,v 1.
1 1999/12/22 15:53:12
mdw Exp $
+ * $Id: dsarand.c,v 1.
2 2000/06/17 10:54:00
mdw Exp $
*
* Random number generator for DSA
*
*
* Random number generator for DSA
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: dsarand.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: dsarand.c,v $
+ * Revision 1.2 2000/06/17 10:54:00 mdw
+ * Typesetting fixes. Arena support.
+ *
* Revision 1.1 1999/12/22 15:53:12 mdw
* Random number generator for finding DSA parameters.
*
* Revision 1.1 1999/12/22 15:53:12 mdw
* Random number generator for finding DSA parameters.
*
@@
-40,6
+43,7
@@
#include <stdarg.h>
#include <string.h>
#include <stdarg.h>
#include <string.h>
+#include <mLib/alloc.h>
#include <mLib/bits.h>
#include <mLib/sub.h>
#include <mLib/bits.h>
#include <mLib/sub.h>
@@
-84,6
+88,7
@@
void dsarand_init(dsarand *d, const void *p, size_t sz)
{
d->p = xmalloc(sz);
d->sz = sz;
{
d->p = xmalloc(sz);
d->sz = sz;
+ d->passes = 1;
if (p)
memcpy(d->p, p, sz);
}
if (p)
memcpy(d->p, p, sz);
}
@@
-101,7
+106,7
@@
void dsarand_init(dsarand *d, const void *p, size_t sz)
void dsarand_reseed(dsarand *d, const void *p, size_t sz)
{
void dsarand_reseed(dsarand *d, const void *p, size_t sz)
{
- free(d->p);
+
x
free(d->p);
d->p = xmalloc(sz);
d->sz = sz;
d->passes = 1;
d->p = xmalloc(sz);
d->sz = sz;
d->passes = 1;
@@
-120,7
+125,7
@@
void dsarand_reseed(dsarand *d, const void *p, size_t sz)
void dsarand_destroy(dsarand *d)
{
void dsarand_destroy(dsarand *d)
{
- free(d->p);
+
x
free(d->p);
}
/* --- @dsarand_fill@ --- *
}
/* --- @dsarand_fill@ --- *
@@
-135,7
+140,7
@@
void dsarand_destroy(dsarand *d)
*
* Let %$p$% be the numerical value of the input buffer, and let
* %$b$% be the number of bytes required. Let
*
* Let %$p$% be the numerical value of the input buffer, and let
* %$b$% be the number of bytes required. Let
- * %$z = \lceil b / 20 \rceil
%$
be the number of SHA outputs
+ * %$z = \lceil b / 20 \rceil
$%
be the number of SHA outputs
* required. Then the output of pass %$n$% is
*
* %$P_n = \sum_{0 \le i < z} 2^{160i} SHA(p + nz + i)$%
* required. Then the output of pass %$n$% is
*
* %$P_n = \sum_{0 \le i < z} 2^{160i} SHA(p + nz + i)$%
@@
-308,7
+313,7
@@
static void gfill(grand *r, void *p, size_t sz)
static const grand_ops gops = {
"dsarand",
static const grand_ops gops = {
"dsarand",
- 0,
+ 0,
0,
gmisc, gdestroy,
grand_word, grand_byte, grand_word, grand_range, gfill
};
gmisc, gdestroy,
grand_word, grand_byte, grand_word, grand_range, gfill
};