Closed darcys22 closed 10 months ago
The data going into v_ will be assumed to be already in montgomery form and the toMont() function will be a noop.
No, Fp::isMont() == true
means that v_
must be in Montgomery form, so setArrayMask
takes a given array and must convert it into a Montgomery form by calling toMont()
.
toMont()
does nothing unless isMont()
is true.
Then setArrayMask
can set the same value whether isMont()
is true or not.
My mistake! thanks for the clarification
This code spans both the bls and mcl libraries but in
bls/src/bls_c_impl.hpp
this function that takes the binary of a hash and maps it to a point:The debugging line returns this:
The effects of this being that when
setArrayMask
is called:The data going into
v_
will be assumed to be already in montgomery form and thetoMont()
function will be a noop.This might be a non-issue because the point that the data gets mapped to is somewhat arbitrary and as long as its consistent I don't think it cause issues. But when trying to match this behaviour in another non c++ library where we haven't got montgomery functions this has caused some difficulty.
Is there a way to set Fp to be not in montgomery form before this setArrayMask happens? (Calling
fromMont()
on the uninitialized t variable perhaps?) and will this cause issues in other places?