mbedtls icon indicating copy to clipboard operation
mbedtls copied to clipboard

constant_time.h: add #ifdef __cplusplus guard

Open nbfalcon opened this issue 9 months ago • 0 comments

All other headers have a __cplusplus guard, except for constant_time.h**. This allows it to be conveniently included in C++ code.

** as verified using grep -L "#ifdef _cplusplus" mbedtls/.h psa/.h, excepting "config" headers.

Workaround: Users using the older library can simply work around this by

extern "C" {
#include <mbedtls/constant_time.h>
}

Description

Allow constant_time.h to be included in a c++ source file without linker errors.

PR checklist

Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")

  • [X] changelog not required, since this is a trivial change?
  • [X] 3.6 backport TODO
  • [X] 2.28 backport TODO
  • [X] tests not required, since this does not change run-time behaviour. A check for this could be done using a lint?

Notes for the submitter

Please refer to the contributing guidelines, especially the checklist for PR contributors.

Help make review efficient:

  • Multiple simple commits
    • please structure your PR into a series of small commits, each of which does one thing
  • Avoid force-push
    • please do not force-push to update your PR - just add new commit(s)
  • See our Guidelines for Contributors for more details about the review process.

nbfalcon avatar May 11 '24 14:05 nbfalcon