#include <stdio.h>
#include <string.h>
#include <time.h>
+#include <sys/time.h>
void bench(double *b)
{
- static struct timespec thistime, lasttime;
+ static struct timeval thistime, lasttime;
static double x = 0;
static double *lastclock = &x;
lasttime = thistime;
- clock_gettime(CLOCK_MONOTONIC, &thistime);
- *lastclock += (thistime.tv_sec - lasttime.tv_sec) + 0.000000001 * (thistime.tv_nsec - lasttime.tv_nsec);
+ gettimeofday(&thistime, NULL);
+ *lastclock += (thistime.tv_sec - lasttime.tv_sec) + 0.000001 * (thistime.tv_usec - lasttime.tv_usec);
lastclock = b;
}
printf("keygen RSA...\n");
if(!d0_blind_id_generate_private_key(ctx_self, 1024))
errx(1, "keygen fail");
+ buf2size = sizeof(buf2) - 1;
+ if(!d0_blind_id_fingerprint64_public_key(ctx_self, buf2, &buf2size))
+ errx(2, "fp64 fail");
+ printf("key has fingerprint %s\n", buf2);
bufsize = sizeof(buf); if(!d0_blind_id_write_public_key(ctx_self, buf, &bufsize))
errx(2, "writepub fail");
if(!d0_blind_id_read_public_key(ctx_other, buf, bufsize))