cf_config.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * cifra - embedded cryptography library
  3. * Written in 2014 by Joseph Birr-Pixton <jpixton@gmail.com>
  4. *
  5. * To the extent possible under law, the author(s) have dedicated all
  6. * copyright and related and neighboring rights to this software to the
  7. * public domain worldwide. This software is distributed without any
  8. * warranty.
  9. *
  10. * You should have received a copy of the CC0 Public Domain Dedication
  11. * along with this software. If not, see
  12. * <http://creativecommons.org/publicdomain/zero/1.0/>.
  13. */
  14. #ifndef CF_CONFIG_H
  15. #define CF_CONFIG_H
  16. /**
  17. * Library configuration
  18. * =====================
  19. */
  20. /* .. c:macro:: CF_SIDE_CHANNEL_PROTECTION
  21. * Define this as 1 if you need all available side channel protections.
  22. * **This option may alter the ABI**.
  23. *
  24. * This has a non-trivial performance penalty. Where a
  25. * side-channel free option is cheap or free (like checking
  26. * a MAC) this is always done in a side-channel free way.
  27. *
  28. * The default is **on** for all available protections.
  29. */
  30. #ifndef CF_SIDE_CHANNEL_PROTECTION
  31. # define CF_SIDE_CHANNEL_PROTECTION 1
  32. #endif
  33. /* .. c:macro:: CF_TIME_SIDE_CHANNEL_PROTECTION
  34. * Define this as 1 if you need timing/branch prediction side channel
  35. * protection.
  36. *
  37. * You probably want this. The default is on. */
  38. #ifndef CF_TIME_SIDE_CHANNEL_PROTECTION
  39. # define CF_TIME_SIDE_CHANNEL_PROTECTION CF_SIDE_CHANNEL_PROTECTION
  40. #endif
  41. /* .. c:macro:: CF_CACHE_SIDE_CHANNEL_PROTECTION
  42. * Define this as 1 if you need cache side channel protection.
  43. *
  44. * If you have a microcontroller with no cache, you can turn this off
  45. * without negative effects.
  46. *
  47. * The default is on. This will have some performance impact,
  48. * especially on AES.
  49. */
  50. #ifndef CF_CACHE_SIDE_CHANNEL_PROTECTION
  51. # define CF_CACHE_SIDE_CHANNEL_PROTECTION CF_SIDE_CHANNEL_PROTECTION
  52. #endif
  53. #endif