supranational / blst

Multilingual BLS12-381 signature library
Apache License 2.0
461 stars 176 forks source link

Do inputs need to be cleared in the rust bindings? #77

Closed dignifiedquire closed 3 years ago

dignifiedquire commented 3 years ago

In the api calls, like

pub fn blst_fp_sqr(ret: *mut blst_fp, a: *const blst_fp);

does ret need to be cleared, or can it contain another value, and will be automatically be cleared?

dot-asm commented 3 years ago

does ret need to be cleared,

No.

dignifiedquire commented 3 years ago

awesome, thanks

dot-asm commented 3 years ago

Just in case for reference, on potentially related note. Output can always [fully] overlap input of the same type modulo its const-ness. Or one of the inputs in case a subroutine takes more than one, like addition or multiplication. Actually, there are exclusions to the "same type" rule. Most notably one can perform in-place serialization/deserialization of the scalars...