LoupVaillant / Monocypher

An easy to use, easy to deploy crypto library
https://monocypher.org
Other
614 stars 80 forks source link

Doesn't compile as C++ #148

Closed mikejsavage closed 4 years ago

mikejsavage commented 4 years ago

Lots of issues like crypto_check_final((void*)&ctx); where it should be casting to crypto_check_ctx_abstract*

LoupVaillant commented 4 years ago

Crap, good catch. Trying with make "CC=gcc -std=c++11 doesn't catch the error, I had to try g++ instead.

Pity we can't just cast to void*. More worrying though is that the implicit cast is likely to fail as well on C++. The incremental API is therefore broken for C++ users (C users only get a warning).

I still think we need inheritance, though. It's ugly, but it's probably the only reasonable way to have several version of EdDSA in the same binary.

Fixing the code right away. Perhaps we should correct the documentation as well? The current way works with C, but C++ users might not be happy.

LoupVaillant commented 4 years ago

(Feel free to reopen if you think the documentation should be fixed)