projects
/
BearSSL
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made m64 implementations of elliptic curves the default (when available).
[BearSSL]
/
src
/
ec
/
ec_all_m31.c
diff --git
a/src/ec/ec_all_m31.c
b/src/ec/ec_all_m31.c
index
0552c4b
..
8fd8c3c
100644
(file)
--- a/
src/ec/ec_all_m31.c
+++ b/
src/ec/ec_all_m31.c
@@
-29,9
+29,17
@@
api_generator(int curve, size_t *len)
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.generator(curve, len);
+#else
return br_ec_p256_m31.generator(curve, len);
return br_ec_p256_m31.generator(curve, len);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.generator(curve, len);
+#else
return br_ec_c25519_m31.generator(curve, len);
return br_ec_c25519_m31.generator(curve, len);
+#endif
default:
return br_ec_prime_i31.generator(curve, len);
}
default:
return br_ec_prime_i31.generator(curve, len);
}
@@
-42,9
+50,17
@@
api_order(int curve, size_t *len)
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.order(curve, len);
+#else
return br_ec_p256_m31.order(curve, len);
return br_ec_p256_m31.order(curve, len);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.order(curve, len);
+#else
return br_ec_c25519_m31.order(curve, len);
return br_ec_c25519_m31.order(curve, len);
+#endif
default:
return br_ec_prime_i31.order(curve, len);
}
default:
return br_ec_prime_i31.order(curve, len);
}
@@
-55,9
+71,17
@@
api_xoff(int curve, size_t *len)
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.xoff(curve, len);
+#else
return br_ec_p256_m31.xoff(curve, len);
return br_ec_p256_m31.xoff(curve, len);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.xoff(curve, len);
+#else
return br_ec_c25519_m31.xoff(curve, len);
return br_ec_c25519_m31.xoff(curve, len);
+#endif
default:
return br_ec_prime_i31.xoff(curve, len);
}
default:
return br_ec_prime_i31.xoff(curve, len);
}
@@
-69,9
+93,17
@@
api_mul(unsigned char *G, size_t Glen,
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.mul(G, Glen, kb, kblen, curve);
+#else
return br_ec_p256_m31.mul(G, Glen, kb, kblen, curve);
return br_ec_p256_m31.mul(G, Glen, kb, kblen, curve);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.mul(G, Glen, kb, kblen, curve);
+#else
return br_ec_c25519_m31.mul(G, Glen, kb, kblen, curve);
return br_ec_c25519_m31.mul(G, Glen, kb, kblen, curve);
+#endif
default:
return br_ec_prime_i31.mul(G, Glen, kb, kblen, curve);
}
default:
return br_ec_prime_i31.mul(G, Glen, kb, kblen, curve);
}
@@
-83,9
+115,17
@@
api_mulgen(unsigned char *R,
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.mulgen(R, x, xlen, curve);
+#else
return br_ec_p256_m31.mulgen(R, x, xlen, curve);
return br_ec_p256_m31.mulgen(R, x, xlen, curve);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.mulgen(R, x, xlen, curve);
+#else
return br_ec_c25519_m31.mulgen(R, x, xlen, curve);
return br_ec_c25519_m31.mulgen(R, x, xlen, curve);
+#endif
default:
return br_ec_prime_i31.mulgen(R, x, xlen, curve);
}
default:
return br_ec_prime_i31.mulgen(R, x, xlen, curve);
}
@@
-98,11
+138,21
@@
api_muladd(unsigned char *A, const unsigned char *B, size_t len,
{
switch (curve) {
case BR_EC_secp256r1:
{
switch (curve) {
case BR_EC_secp256r1:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_p256_m64.muladd(A, B, len,
+ x, xlen, y, ylen, curve);
+#else
return br_ec_p256_m31.muladd(A, B, len,
x, xlen, y, ylen, curve);
return br_ec_p256_m31.muladd(A, B, len,
x, xlen, y, ylen, curve);
+#endif
case BR_EC_curve25519:
case BR_EC_curve25519:
+#if BR_INT128 || BR_UMUL128
+ return br_ec_c25519_m64.muladd(A, B, len,
+ x, xlen, y, ylen, curve);
+#else
return br_ec_c25519_m31.muladd(A, B, len,
x, xlen, y, ylen, curve);
return br_ec_c25519_m31.muladd(A, B, len,
x, xlen, y, ylen, curve);
+#endif
default:
return br_ec_prime_i31.muladd(A, B, len,
x, xlen, y, ylen, curve);
default:
return br_ec_prime_i31.muladd(A, B, len,
x, xlen, y, ylen, curve);