cocagne / pysrp

Python implementation of the Secure Remote Password protocol (SRP)
MIT License
113 stars 42 forks source link

Fix side channel leaks #43

Closed ddealmei closed 3 years ago

ddealmei commented 3 years ago

Calling BN_mod_exp with a small base, and no constant time flag fallback on an insecure implementation with OpenSSL. A simple fix is to set the appropriate flag before the modular exponentiation.

ddealmei commented 3 years ago

In absence of a clean way to get OpenSSL BN_FLG_CONSTTIME value from Python (since it is defined as a macro), I hardcoded it into the python code.