floodyberry / ed25519-donna

Implementations of a fast Elliptic-curve Digital Signature Algorithm
169 stars 47 forks source link

Thread safety #14

Closed ghost closed 10 years ago

ghost commented 10 years ago

floodberry,

Again, I can't thank you enough for this amazingly fast lib!

I'm a big time noob and know enough just to be dangerous. Is this library thread safe in c++?

I do nothing but use the variables and functions outlined in the readme.

Thank you so much in advance!

floodyberry commented 10 years ago

yes, everything is thread safe.

https://github.com/floodyberry/ed25519-donna/blob/master/ed25519-donna-batchverify.h#L200 is technically not, but it's only used by test.c to verify that batch verification is working correctly and is not needed by anything internally.

ghost commented 10 years ago

I can't thank you enough floodberry!

ghost commented 10 years ago

Sorry, does your comment mean that ed25519_sign_open_batch is not thread safe?

Thank you again so much in advance!

floodyberry commented 10 years ago

The value of batch_point_buffer will be unreliable if multiple threads are calling ge25519_is_neutral_vartime at the same time, but that variable is only referenced at https://github.com/floodyberry/ed25519-donna/blob/master/test.c#L185

So it's unsafe to call test_batch from multiple threads, but if you're actually verifying points it's completely safe

ghost commented 10 years ago

Thank you floodberry!

I'm in love with this lib!