Reputation: 33
In openssl C code, (aes_core.c, set_key.c, spr.h and so on) there is "__fips_constseg".
I don't know "__fips_constseg" means.
What's the role of it? Is it assembly code?
the source code is below:
#include < openssl/crypto.h >
#include "des_locl.h"
OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */
__fips_constseg
static const unsigned char odd_parity[256]={};
Upvotes: 1
Views: 257
Reputation: 3295
From the OpenSSL source code:
#if defined(OPENSSL_FIPSCANISTER)
# include <openssl/fipssyms.h>
#else
# define __fips_constseg
#endif
#if defined(_MSC_VER)
# pragma const_seg("fipsro$b")
# pragma const_seg()
# define __fips_constseg __declspec(allocate("fipsro$b"))
#else
# define __fips_constseg
#endif
The __fips_constseg
constant thus is only defined to a value, if
OPENSSL_FIPSCANISTER
is defined and_MSC_VER
constant).Then, the code marked with that constant is placed in the constant data segment named fipsro$b
(see the MSDN documentation on the allocate
specifier for details).
If any of the conditions above is not met, __fips_constseg
is defined to nothing and thus the variables marked with that constant are put in the data segment they would normally be located in.
Upvotes: 2