I need to take the natural logarithm of a number, in such a way that access patterns and running time leak no information about the input/output.
Does the provided "cmath" standard library satisfy this criterion? If not, would you please point me to some literature on side-channel resistant real-valued computation?
This article suggests the usage of bitwise if possible
Please see GNUC preliminary safety assessment for these math functions and their associated POSIX safety concepts before use:
Thank you for your reply Hoang.
The Wikipedia article is of no use, since it only expounds on the concept of timing attacks. There is a brief reference to exponentiation, but not to its inverse.
The GNU documentation is not useful either, since it makes no reference to cryptographic security.
Thank you for getting back so quickly.
The paper by Costan and Devadas, although a great document (I personally started with SGX by reading it) doesn't help in this particular case.
What I need is a side-channel-resistant implementation of a (natural) logarithm.
If you are just trying to stop an attack on measuring the processing time with different input and output, can you simply use the brute force approach by adding a small random number of wasted cycles in your processing in the Enclave such as taking a modulo of your secret hash number with a prime number? It will make the processing time undecodable.
Regarding to your natural logarithm, if you can substitute it with binary logarithm, then you can implement it with shift operations. Therefore, you don't need to include any math library.
If you do need to include math library, as long as you can statically link the library into your application, it is a good step to make sure it can be run inside the Enclave. Further security analysis of that library should be done to make sure it is still safe to call.