Skip to content

Commit

Permalink
use non parallel impl of g1 and g2 msm for values of k = 1
Browse files Browse the repository at this point in the history
Signed-off-by: garyschulte <garyschulte@gmail.com>
  • Loading branch information
garyschulte committed Dec 13, 2024
1 parent d550463 commit ee878ef
Showing 1 changed file with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ public static int eip2537_perform_operation(
o_len.setValue(128);
break;
case BLS12_G1MULTIEXP_OPERATION_SHIM_VALUE:
ret = eip2537blsG1MultiExpParallel(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES,
EIP2537_PREALLOCATE_FOR_ERROR_BYTES,
degreeOfMSMParallelism);
o_len.setValue(128);
if (i.length <= 192) {
ret = eip2537blsG1MultiExp(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES, EIP2537_PREALLOCATE_FOR_ERROR_BYTES);
} else {
ret = eip2537blsG1MultiExpParallel(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES, EIP2537_PREALLOCATE_FOR_ERROR_BYTES,
degreeOfMSMParallelism);
o_len.setValue(128);
}
break;
case BLS12_G2ADD_OPERATION_SHIM_VALUE:
ret = eip2537blsG2Add(i, output, err, i_len,
Expand All @@ -83,11 +87,16 @@ public static int eip2537_perform_operation(
o_len.setValue(256);
break;
case BLS12_G2MULTIEXP_OPERATION_SHIM_VALUE:
ret = eip2537blsG2MultiExpParallel(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES,
EIP2537_PREALLOCATE_FOR_ERROR_BYTES,
degreeOfMSMParallelism);
o_len.setValue(256);
if (i.length <= 288) {
ret = eip2537blsG2MultiExp(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES,
EIP2537_PREALLOCATE_FOR_ERROR_BYTES);
} else {
ret = eip2537blsG2MultiExpParallel(i, output, err, i_len,
EIP2537_PREALLOCATE_FOR_RESULT_BYTES, EIP2537_PREALLOCATE_FOR_ERROR_BYTES,
degreeOfMSMParallelism);
o_len.setValue(256);
}
break;
case BLS12_PAIR_OPERATION_SHIM_VALUE:
ret = eip2537blsPairing(i, output, err, i_len,
Expand Down

0 comments on commit ee878ef

Please sign in to comment.