]> de.git.xonotic.org Git - xonotic/d0_blind_id.git/blobdiff - main.c
const-ify some declarations
[xonotic/d0_blind_id.git] / main.c
diff --git a/main.c b/main.c
index 3c233e8e5a7fed2068b69ae882da1df082daeb06..0efb624e7d59b42599c342137394e786495dda5a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -22,15 +22,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #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;
 }
 
@@ -56,6 +57,10 @@ int main(int argc, char **argv)
        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))