projects
/
BearSSL
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed some errors in comments.
[BearSSL]
/
src
/
ec
/
ec_all_m31.c
diff --git
a/src/ec/ec_all_m31.c
b/src/ec/ec_all_m31.c
index
b217d7c
..
8fd8c3c
100644
(file)
--- a/
src/ec/ec_all_m31.c
+++ b/
src/ec/ec_all_m31.c
@@
-29,10
+29,14
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.generator(curve, len);
+ return br_ec_c25519_m6
4
.generator(curve, len);
#else
return br_ec_c25519_m31.generator(curve, len);
#endif
#else
return br_ec_c25519_m31.generator(curve, len);
#endif
@@
-46,10
+50,14
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.order(curve, len);
+ return br_ec_c25519_m6
4
.order(curve, len);
#else
return br_ec_c25519_m31.order(curve, len);
#endif
#else
return br_ec_c25519_m31.order(curve, len);
#endif
@@
-63,10
+71,14
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.xoff(curve, len);
+ return br_ec_c25519_m6
4
.xoff(curve, len);
#else
return br_ec_c25519_m31.xoff(curve, len);
#endif
#else
return br_ec_c25519_m31.xoff(curve, len);
#endif
@@
-81,10
+93,14
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.mul(G, Glen, kb, kblen, curve);
+ return br_ec_c25519_m6
4
.mul(G, Glen, kb, kblen, curve);
#else
return br_ec_c25519_m31.mul(G, Glen, kb, kblen, curve);
#endif
#else
return br_ec_c25519_m31.mul(G, Glen, kb, kblen, curve);
#endif
@@
-99,10
+115,14
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.mulgen(R, x, xlen, curve);
+ return br_ec_c25519_m6
4
.mulgen(R, x, xlen, curve);
#else
return br_ec_c25519_m31.mulgen(R, x, xlen, curve);
#endif
#else
return br_ec_c25519_m31.mulgen(R, x, xlen, curve);
#endif
@@
-118,11
+138,16
@@
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:
#if BR_INT128 || BR_UMUL128
case BR_EC_curve25519:
#if BR_INT128 || BR_UMUL128
- return br_ec_c25519_m6
2
.muladd(A, B, len,
+ return br_ec_c25519_m6
4
.muladd(A, B, len,
x, xlen, y, ylen, curve);
#else
return br_ec_c25519_m31.muladd(A, B, len,
x, xlen, y, ylen, curve);
#else
return br_ec_c25519_m31.muladd(A, B, len,