-
-
Save bwesterb/7807763 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./run | |
-- Curve SECG-K256: | |
real 0m3.534s | |
user 0m2.253s | |
sys 0m1.280s | |
$ time pol -w 1 touch | |
[==============================================================================] | |
real 0m2.084s | |
user 0m2.042s | |
sys 0m0.070s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cc -Irelic-0.3.5/include \ | |
-Irelic-target/include \ | |
-Lrelic-target/lib \ | |
-lrelic \ | |
-O3 \ | |
test.c -o test \ | |
&& time ./test | |
ret=$? | |
if [ $ret != 0 ]; then | |
echo Exit code $ret | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "relic.h" | |
#include "relic_ec.h" | |
#include "relic_bn.h" | |
void bench_relic_ec() | |
{ | |
int i; | |
ec_t p; | |
ec_t t; | |
bn_t r; | |
bn_t o; | |
ec_new(p); | |
ec_new(t); | |
bn_new(r); | |
bn_new(o); | |
ec_curve_get_ord(o); | |
ec_rand(p); | |
bn_rand(r, BN_POS, bn_bits(o)); | |
for (i = 0; i < 4000; i++) { | |
ec_mul(t, p, r); | |
} | |
ec_free(t); | |
ec_free(p); | |
bn_free(r); | |
bn_free(o); | |
} | |
int main(int argc, char** argv) | |
{ | |
if(core_init() != STS_OK) { | |
core_clean(); | |
return 1; | |
} | |
if (ec_param_set_any() == STS_OK) { | |
ec_param_print(); | |
bench_relic_ec(); | |
} else { | |
return 2; | |
} | |
core_clean(); | |
return 0; | |
} | |
/* vi: set sw=4 ts=4 bs=2 : */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment