* Program variables
*/
extern char *optarg; /* command line argument */
+char *progname;
int debug = 0; /* debug, not de bug */
int rval; /* return status */
#ifdef OPENSSL
#endif /* OPENSSL */
char hostbuf[MAXHOSTNAME + 1];
+ progname = argv[0];
+
#ifdef SYS_WINNT
/* Initialize before OpenSSL checks */
InitWin32Sockets();
char *tld;
sptr = strrchr(filename, '.');
- tld = malloc(strlen(sptr)); /* we have an extra byte ... */
+ tld = emalloc(strlen(sptr)); /* we have an extra byte ... */
strcpy(tld, 1+sptr); /* ... see? */
sprintf(filename, "ntpkey_IFFkey_%s.%s", trustname,
tld);
dsa->p = BN_new();
dsa->q = BN_new();
dsa->g = BN_new();
- s = malloc((n + 1) * sizeof(BIGNUM));
- s1 = malloc((n + 1) * sizeof(BIGNUM));
+ s = emalloc((n + 1) * sizeof(BIGNUM));
+ s1 = emalloc((n + 1) * sizeof(BIGNUM));
for (j = 1; j <= n; j++)
s1[j] = BN_new();
temp = 0;
fprintf(stderr,
"Generating polynomial coefficients for %d roots (%d bits)\n",
n, BN_num_bits(dsa->q));
- x = malloc((n + 1) * sizeof(BIGNUM));
+ x = emalloc((n + 1) * sizeof(BIGNUM));
for (j = 1; j <= n; j++) {
x[j] = BN_new();
while (1) {
* expansion of root products (x - x[j]) mod q for all j. The
* method is a present from Charlie Boncelet.
*/
- a = malloc((n + 1) * sizeof(BIGNUM));
+ a = emalloc((n + 1) * sizeof(BIGNUM));
for (i = 0; i <= n; i++) {
a[i] = BN_new();
BN_one(a[i]);
* Generate g[i] = g^a[i] mod p for all i and the generator g.
*/
fprintf(stderr, "Generating g[i] parameters\n");
- g = malloc((n + 1) * sizeof(BIGNUM));
+ g = emalloc((n + 1) * sizeof(BIGNUM));
for (i = 0; i <= n; i++) {
g[i] = BN_new();
BN_mod_exp(g[i], dsa->g, a[i], dsa->p, ctx);
* or the product s = prod(s'[j]) mod q, which is the enabling
* key.
*/
- xbar = malloc((n + 1) * sizeof(BIGNUM));
- xhat = malloc((n + 1) * sizeof(BIGNUM));
+ xbar = emalloc((n + 1) * sizeof(BIGNUM));
+ xhat = emalloc((n + 1) * sizeof(BIGNUM));
for (j = 1; j <= n; j++) {
xbar[j] = BN_new(); xhat[j] = BN_new();
BN_zero(xbar[j]);