提交 03e389cf 编写于 作者: A Andy Polyakov

Allow for dynamic base in Win64 FIPS module.

上级 93256bf5
......@@ -54,6 +54,7 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e];
Td4[x] = Si[x].[01];
*/
__fips_constseg
static const u32 Te0[256] = {
0xc66363a5U, 0xf87c7c84U, 0xee777799U, 0xf67b7b8dU,
0xfff2f20dU, 0xd66b6bbdU, 0xde6f6fb1U, 0x91c5c554U,
......@@ -120,6 +121,7 @@ static const u32 Te0[256] = {
0x824141c3U, 0x299999b0U, 0x5a2d2d77U, 0x1e0f0f11U,
0x7bb0b0cbU, 0xa85454fcU, 0x6dbbbbd6U, 0x2c16163aU,
};
__fips_constseg
static const u32 Te1[256] = {
0xa5c66363U, 0x84f87c7cU, 0x99ee7777U, 0x8df67b7bU,
0x0dfff2f2U, 0xbdd66b6bU, 0xb1de6f6fU, 0x5491c5c5U,
......@@ -186,6 +188,7 @@ static const u32 Te1[256] = {
0xc3824141U, 0xb0299999U, 0x775a2d2dU, 0x111e0f0fU,
0xcb7bb0b0U, 0xfca85454U, 0xd66dbbbbU, 0x3a2c1616U,
};
__fips_constseg
static const u32 Te2[256] = {
0x63a5c663U, 0x7c84f87cU, 0x7799ee77U, 0x7b8df67bU,
0xf20dfff2U, 0x6bbdd66bU, 0x6fb1de6fU, 0xc55491c5U,
......@@ -252,6 +255,7 @@ static const u32 Te2[256] = {
0x41c38241U, 0x99b02999U, 0x2d775a2dU, 0x0f111e0fU,
0xb0cb7bb0U, 0x54fca854U, 0xbbd66dbbU, 0x163a2c16U,
};
__fips_constseg
static const u32 Te3[256] = {
0x6363a5c6U, 0x7c7c84f8U, 0x777799eeU, 0x7b7b8df6U,
0xf2f20dffU, 0x6b6bbdd6U, 0x6f6fb1deU, 0xc5c55491U,
......@@ -319,6 +323,7 @@ static const u32 Te3[256] = {
0xb0b0cb7bU, 0x5454fca8U, 0xbbbbd66dU, 0x16163a2cU,
};
__fips_constseg
static const u32 Td0[256] = {
0x51f4a750U, 0x7e416553U, 0x1a17a4c3U, 0x3a275e96U,
0x3bab6bcbU, 0x1f9d45f1U, 0xacfa58abU, 0x4be30393U,
......@@ -385,6 +390,7 @@ static const u32 Td0[256] = {
0x39a80171U, 0x080cb3deU, 0xd8b4e49cU, 0x6456c190U,
0x7bcb8461U, 0xd532b670U, 0x486c5c74U, 0xd0b85742U,
};
__fips_constseg
static const u32 Td1[256] = {
0x5051f4a7U, 0x537e4165U, 0xc31a17a4U, 0x963a275eU,
0xcb3bab6bU, 0xf11f9d45U, 0xabacfa58U, 0x934be303U,
......@@ -451,6 +457,7 @@ static const u32 Td1[256] = {
0x7139a801U, 0xde080cb3U, 0x9cd8b4e4U, 0x906456c1U,
0x617bcb84U, 0x70d532b6U, 0x74486c5cU, 0x42d0b857U,
};
__fips_constseg
static const u32 Td2[256] = {
0xa75051f4U, 0x65537e41U, 0xa4c31a17U, 0x5e963a27U,
0x6bcb3babU, 0x45f11f9dU, 0x58abacfaU, 0x03934be3U,
......@@ -517,6 +524,7 @@ static const u32 Td2[256] = {
0x017139a8U, 0xb3de080cU, 0xe49cd8b4U, 0xc1906456U,
0x84617bcbU, 0xb670d532U, 0x5c74486cU, 0x5742d0b8U,
};
__fips_constseg
static const u32 Td3[256] = {
0xf4a75051U, 0x4165537eU, 0x17a4c31aU, 0x275e963aU,
0xab6bcb3bU, 0x9d45f11fU, 0xfa58abacU, 0xe303934bU,
......@@ -583,6 +591,7 @@ static const u32 Td3[256] = {
0xa8017139U, 0x0cb3de08U, 0xb4e49cd8U, 0x56c19064U,
0xcb84617bU, 0x32b670d5U, 0x6c5c7448U, 0xb85742d0U,
};
__fips_constseg
static const u8 Td4[256] = {
0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
......@@ -617,6 +626,7 @@ static const u8 Td4[256] = {
0x17U, 0x2bU, 0x04U, 0x7eU, 0xbaU, 0x77U, 0xd6U, 0x26U,
0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU,
};
__fips_constseg
static const u32 rcon[] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
......
......@@ -101,6 +101,7 @@
/* Maximum number of iterations before BN_GF2m_mod_solve_quad_arr should fail. */
#define MAX_ITERATIONS 50
__fips_constseg
static const BN_ULONG SQR_tb[16] =
{ 0, 1, 4, 5, 16, 17, 20, 21,
64, 65, 68, 69, 80, 81, 84, 85 };
......
......@@ -69,6 +69,7 @@
#include "cryptlib.h"
#include "bn_lcl.h"
__fips_constseg
const char BN_version[]="Big Number" OPENSSL_VERSION_PTEXT;
/* This stuff appears to be completely unused, so is deprecated */
......@@ -143,6 +144,7 @@ const BIGNUM *BN_value_one(void)
int BN_num_bits_word(BN_ULONG l)
{
__fips_constseg
static const unsigned char bits[256]={
0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
......
......@@ -68,27 +68,32 @@
/* pre-computed tables are "carry-less" values of modulus*(i+1) */
#if BN_BITS2 == 64
__fips_constseg
static const BN_ULONG _nist_p_192[][BN_NIST_192_TOP] = {
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFEULL,0xFFFFFFFFFFFFFFFFULL},
{0xFFFFFFFFFFFFFFFEULL,0xFFFFFFFFFFFFFFFDULL,0xFFFFFFFFFFFFFFFFULL},
{0xFFFFFFFFFFFFFFFDULL,0xFFFFFFFFFFFFFFFCULL,0xFFFFFFFFFFFFFFFFULL}
};
__fips_constseg
static const BN_ULONG _nist_p_192_sqr[] = {
0x0000000000000001ULL,0x0000000000000002ULL,0x0000000000000001ULL,
0xFFFFFFFFFFFFFFFEULL,0xFFFFFFFFFFFFFFFDULL,0xFFFFFFFFFFFFFFFFULL
};
__fips_constseg
static const BN_ULONG _nist_p_224[][BN_NIST_224_TOP] = {
{0x0000000000000001ULL,0xFFFFFFFF00000000ULL,
0xFFFFFFFFFFFFFFFFULL,0x00000000FFFFFFFFULL},
{0x0000000000000002ULL,0xFFFFFFFE00000000ULL,
0xFFFFFFFFFFFFFFFFULL,0x00000001FFFFFFFFULL} /* this one is "carry-full" */
};
__fips_constseg
static const BN_ULONG _nist_p_224_sqr[] = {
0x0000000000000001ULL,0xFFFFFFFE00000000ULL,
0xFFFFFFFFFFFFFFFFULL,0x0000000200000000ULL,
0x0000000000000000ULL,0xFFFFFFFFFFFFFFFEULL,
0xFFFFFFFFFFFFFFFFULL
};
__fips_constseg
static const BN_ULONG _nist_p_256[][BN_NIST_256_TOP] = {
{0xFFFFFFFFFFFFFFFFULL,0x00000000FFFFFFFFULL,
0x0000000000000000ULL,0xFFFFFFFF00000001ULL},
......@@ -101,12 +106,14 @@ static const BN_ULONG _nist_p_256[][BN_NIST_256_TOP] = {
{0xFFFFFFFFFFFFFFFBULL,0x00000004FFFFFFFFULL,
0x0000000000000000ULL,0xFFFFFFFB00000005ULL},
};
__fips_constseg
static const BN_ULONG _nist_p_256_sqr[] = {
0x0000000000000001ULL,0xFFFFFFFE00000000ULL,
0xFFFFFFFFFFFFFFFFULL,0x00000001FFFFFFFEULL,
0x00000001FFFFFFFEULL,0x00000001FFFFFFFEULL,
0xFFFFFFFE00000001ULL,0xFFFFFFFE00000002ULL
};
__fips_constseg
static const BN_ULONG _nist_p_384[][BN_NIST_384_TOP] = {
{0x00000000FFFFFFFFULL,0xFFFFFFFF00000000ULL,0xFFFFFFFFFFFFFFFEULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
......@@ -119,18 +126,21 @@ static const BN_ULONG _nist_p_384[][BN_NIST_384_TOP] = {
{0x00000004FFFFFFFBULL,0xFFFFFFFB00000000ULL,0xFFFFFFFFFFFFFFFAULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL},
};
__fips_constseg
static const BN_ULONG _nist_p_384_sqr[] = {
0xFFFFFFFE00000001ULL,0x0000000200000000ULL,0xFFFFFFFE00000000ULL,
0x0000000200000000ULL,0x0000000000000001ULL,0x0000000000000000ULL,
0x00000001FFFFFFFEULL,0xFFFFFFFE00000000ULL,0xFFFFFFFFFFFFFFFDULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL
};
__fips_constseg
static const BN_ULONG _nist_p_521[] =
{0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
0xFFFFFFFFFFFFFFFFULL,0xFFFFFFFFFFFFFFFFULL,
0x00000000000001FFULL};
__fips_constseg
static const BN_ULONG _nist_p_521_sqr[] = {
0x0000000000000001ULL,0x0000000000000000ULL,0x0000000000000000ULL,
0x0000000000000000ULL,0x0000000000000000ULL,0x0000000000000000ULL,
......@@ -140,27 +150,32 @@ static const BN_ULONG _nist_p_521_sqr[] = {
0xFFFFFFFFFFFFFFFFULL,0x000000000003FFFFULL
};
#elif BN_BITS2 == 32
__fips_constseg
static const BN_ULONG _nist_p_192[][BN_NIST_192_TOP] = {
{0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFE,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
{0xFFFFFFFE,0xFFFFFFFF,0xFFFFFFFD,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
{0xFFFFFFFD,0xFFFFFFFF,0xFFFFFFFC,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}
};
__fips_constseg
static const BN_ULONG _nist_p_192_sqr[] = {
0x00000001,0x00000000,0x00000002,0x00000000,0x00000001,0x00000000,
0xFFFFFFFE,0xFFFFFFFF,0xFFFFFFFD,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF
};
__fips_constseg
static const BN_ULONG _nist_p_224[][BN_NIST_224_TOP] = {
{0x00000001,0x00000000,0x00000000,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
{0x00000002,0x00000000,0x00000000,0xFFFFFFFE,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}
};
__fips_constseg
static const BN_ULONG _nist_p_224_sqr[] = {
0x00000001,0x00000000,0x00000000,0xFFFFFFFE,
0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000002,
0x00000000,0x00000000,0xFFFFFFFE,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF
};
__fips_constseg
static const BN_ULONG _nist_p_256[][BN_NIST_256_TOP] = {
{0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000,
0x00000000,0x00000000,0x00000001,0xFFFFFFFF},
......@@ -173,12 +188,14 @@ static const BN_ULONG _nist_p_256[][BN_NIST_256_TOP] = {
{0xFFFFFFFB,0xFFFFFFFF,0xFFFFFFFF,0x00000004,
0x00000000,0x00000000,0x00000005,0xFFFFFFFB},
};
__fips_constseg
static const BN_ULONG _nist_p_256_sqr[] = {
0x00000001,0x00000000,0x00000000,0xFFFFFFFE,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFE,0x00000001,
0xFFFFFFFE,0x00000001,0xFFFFFFFE,0x00000001,
0x00000001,0xFFFFFFFE,0x00000002,0xFFFFFFFE
};
__fips_constseg
static const BN_ULONG _nist_p_384[][BN_NIST_384_TOP] = {
{0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFE,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
......@@ -191,16 +208,19 @@ static const BN_ULONG _nist_p_384[][BN_NIST_384_TOP] = {
{0xFFFFFFFB,0x00000004,0x00000000,0xFFFFFFFB,0xFFFFFFFA,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF},
};
__fips_constseg
static const BN_ULONG _nist_p_384_sqr[] = {
0x00000001,0xFFFFFFFE,0x00000000,0x00000002,0x00000000,0xFFFFFFFE,
0x00000000,0x00000002,0x00000001,0x00000000,0x00000000,0x00000000,
0xFFFFFFFE,0x00000001,0x00000000,0xFFFFFFFE,0xFFFFFFFD,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF
};
__fips_constseg
static const BN_ULONG _nist_p_521[] = {0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,
0xFFFFFFFF,0x000001FF};
__fips_constseg
static const BN_ULONG _nist_p_521_sqr[] = {
0x00000001,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
......
......@@ -63,6 +63,7 @@ typedef unsigned short prime_t;
#define NUMPRIMES 54
typedef unsigned char prime_t;
#endif
__fips_constseg
static const prime_t primes[NUMPRIMES]=
{
2, 3, 5, 7, 11, 13, 17, 19,
......
......@@ -148,7 +148,9 @@
*/
#if defined(OPENSSL_FIPSCANISTER)
#include <openssl/fipssyms.h>
# include <openssl/fipssyms.h>
#else
# define __fips_constseg
#endif
#ifdef __cplusplus
......
......@@ -30,6 +30,7 @@
* crypt() implementations do. The patch was sent by
* Bjorn Gronvall <bg@sics.se>
*/
__fips_constseg
static unsigned const char con_salt[128]={
0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,
0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1,
......@@ -49,6 +50,7 @@ static unsigned const char con_salt[128]={
0x3D,0x3E,0x3F,0x40,0x41,0x42,0x43,0x44,
};
__fips_constseg
static unsigned const char cov_2char[64]={
0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,
0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,
......
......@@ -68,6 +68,7 @@
OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key,0) /* defaults to false */
__fips_constseg
static const unsigned char odd_parity[256]={
1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14,
16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31,
......@@ -116,6 +117,7 @@ int DES_check_key_parity(const_DES_cblock *key)
* (and actual cblock values).
*/
#define NUM_WEAK_KEY 16
__fips_constseg
static const DES_cblock weak_keys[NUM_WEAK_KEY]={
/* weak keys */
{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
......@@ -161,6 +163,7 @@ int DES_is_weak_key(const_DES_cblock *key)
#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\
(a)=(a)^(t)^(t>>(16-(n))))
__fips_constseg
static const DES_LONG des_skb[8][64]={
{
/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
......@@ -337,6 +340,7 @@ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule)
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule)
{
__fips_constseg
static const int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
register DES_LONG c,d,t,s,t2;
register const unsigned char *in;
......
......@@ -56,6 +56,7 @@
* [including the GNU Public Licence.]
*/
__fips_constseg
OPENSSL_GLOBAL const DES_LONG DES_SPtrans[8][64]={
{
/* nibble 0 */
......
......@@ -691,6 +691,7 @@ end:
for (;;)
{
__fips_constseg
static const unsigned char ggen[4] = {0x67,0x67,0x65,0x6e};
if (idx >= 0)
{
......
......@@ -84,6 +84,7 @@ typedef struct {
} EC_CURVE_DATA;
/* the nist prime curves */
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_NIST_PRIME_192 = {
{ NID_X9_62_prime_field,20,24,1 },
......@@ -110,6 +111,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0xB4,0xD2,0x28,0x31 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+28*6]; }
_EC_NIST_PRIME_224 = {
{ NID_X9_62_prime_field,20,28,1 },
......@@ -136,6 +138,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+28*6]; }
0x13,0xDD,0x29,0x45,0x5C,0x5C,0x2A,0x3D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+48*6]; }
_EC_NIST_PRIME_384 = {
{ NID_X9_62_prime_field,20,48,1 },
......@@ -174,6 +177,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+48*6]; }
0xEC,0xEC,0x19,0x6A,0xCC,0xC5,0x29,0x73 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+66*6]; }
_EC_NIST_PRIME_521 = {
{ NID_X9_62_prime_field,20,66,1 },
......@@ -225,6 +229,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+66*6]; }
};
/* the x9.62 prime curves (minus the nist prime curves) */
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_X9_62_PRIME_192V2 = {
{ NID_X9_62_prime_field,20,24,1 },
......@@ -251,6 +256,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0x48,0xD8,0xDD,0x31 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_X9_62_PRIME_192V3 = {
{ NID_X9_62_prime_field,20,24,1 },
......@@ -277,6 +283,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0xF6,0x40,0xEC,0x13 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_PRIME_239V1 = {
{ NID_X9_62_prime_field,20,30,1 },
......@@ -308,6 +315,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0x90,0x71,0xFB,0xD1,0x52,0x26,0x88,0x90,0x9D,0x0B }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_PRIME_239V2 = {
{ NID_X9_62_prime_field,20,30,1 },
......@@ -339,6 +347,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0x77,0xD4,0x14,0xC0,0x38,0x21,0xBC,0x58,0x20,0x63 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_PRIME_239V3 = {
{ NID_X9_62_prime_field,20,30,1 },
......@@ -371,6 +380,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+32*6]; }
_EC_X9_62_PRIME_256V1 = {
{ NID_X9_62_prime_field,20,32,1 },
......@@ -404,6 +414,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+32*6]; }
};
/* the secg prime curves (minus the nist and x9.62 prime curves) */
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
_EC_SECG_PRIME_112R1 = {
{ NID_X9_62_prime_field,20,14,1 },
......@@ -424,6 +435,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
0xAC,0x65,0x61,0xC5 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
_EC_SECG_PRIME_112R2 = {
{ NID_X9_62_prime_field,20,14,4 },
......@@ -444,6 +456,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+14*6]; }
0x05,0x20,0xD0,0x4B }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
_EC_SECG_PRIME_128R1 = {
{ NID_X9_62_prime_field,20,16,1 },
......@@ -464,6 +477,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
0x0D,0x1B,0x90,0x38,0xA1,0x15 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
_EC_SECG_PRIME_128R2 = {
{ NID_X9_62_prime_field,20,16,4 },
......@@ -484,6 +498,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+16*6]; }
0x24,0x72,0x06,0x13,0xB5,0xA3 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
_EC_SECG_PRIME_160K1 = {
{ NID_X9_62_prime_field,0,21,1 },
......@@ -508,6 +523,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
0xB3 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
_EC_SECG_PRIME_160R1 = {
{ NID_X9_62_prime_field,20,21,1 },
......@@ -534,6 +550,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
0x57 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
_EC_SECG_PRIME_160R2 = {
{ NID_X9_62_prime_field,20,21,1 },
......@@ -560,6 +577,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
0x6B }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+24*6]; }
_EC_SECG_PRIME_192K1 = {
{ NID_X9_62_prime_field,0,24,1 },
......@@ -584,6 +602,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+24*6]; }
0x74,0xDE,0xFD,0x8D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+29*6]; }
_EC_SECG_PRIME_224K1 = {
{ NID_X9_62_prime_field,0,29,1 },
......@@ -608,6 +627,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+29*6]; }
0x84,0xCA,0xF0,0xA9,0x71,0x76,0x9F,0xB1,0xF7 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+32*6]; }
_EC_SECG_PRIME_256K1 = {
{ NID_X9_62_prime_field,0,32,1 },
......@@ -639,6 +659,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+32*6]; }
};
/* some wap/wtls curves */
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
_EC_WTLS_8 = {
{ NID_X9_62_prime_field,0,15,1 },
......@@ -657,6 +678,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
0x55,0x1A,0xD8,0x37,0xE9 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
_EC_WTLS_9 = {
{ NID_X9_62_prime_field,0,21,1 },
......@@ -681,6 +703,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
0x33 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+28*6]; }
_EC_WTLS_12 = {
{ NID_X9_62_prime_field,0,28,1 },
......@@ -708,6 +731,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+28*6]; }
#ifndef OPENSSL_NO_EC2M
/* characteristic two curves */
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
_EC_SECG_CHAR2_113R1 = {
{ NID_X9_62_characteristic_two_field,20,15,2 },
......@@ -728,6 +752,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
0xEC,0x8A,0x39,0xE5,0x6F }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
_EC_SECG_CHAR2_113R2 = {
{ NID_X9_62_characteristic_two_field,20,15,2 },
......@@ -748,6 +773,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+15*6]; }
0x9B,0x24,0x96,0xAF,0x93 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
_EC_SECG_CHAR2_131R1 = {
{ NID_X9_62_characteristic_two_field,20,17,2 },
......@@ -768,6 +794,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
0x23,0x95,0x3A,0x94,0x64,0xB5,0x4D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
_EC_SECG_CHAR2_131R2 = {
{ NID_X9_62_characteristic_two_field,20,17,2 },
......@@ -788,6 +815,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+17*6]; }
0x54,0xA2,0x33,0x04,0x9B,0xA9,0x8F }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
_EC_NIST_CHAR2_163K = {
{ NID_X9_62_characteristic_two_field,0,21,2 },
......@@ -812,6 +840,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
0xEF }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
_EC_SECG_CHAR2_163R1 = {
{ NID_X9_62_characteristic_two_field,0,21,2 },
......@@ -843,6 +872,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
0x9B }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
_EC_NIST_CHAR2_163B = {
{ NID_X9_62_characteristic_two_field,0,21,2 },
......@@ -873,6 +903,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+21*6]; }
0x33 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
_EC_SECG_CHAR2_193R1 = {
{ NID_X9_62_characteristic_two_field,20,25,2 },
......@@ -899,6 +930,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
0xCC,0x92,0x0E,0xBA,0x49 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
_EC_SECG_CHAR2_193R2 = {
{ NID_X9_62_characteristic_two_field,20,25,2 },
......@@ -925,6 +957,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+25*6]; }
0xCC,0xD4,0xEE,0x99,0xD5 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
_EC_NIST_CHAR2_233K = {
{ NID_X9_62_characteristic_two_field,0,30,4 },
......@@ -954,6 +987,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
0xBC,0xD4,0x6E,0xFB,0x1A,0xD5,0xF1,0x73,0xAB,0xDF }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_NIST_CHAR2_233B = {
{ NID_X9_62_characteristic_two_field,20,30,2 },
......@@ -985,6 +1019,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0x8A,0x69,0x22,0x03,0x1D,0x26,0x03,0xCF,0xE0,0xD7 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
_EC_SECG_CHAR2_239K1 = {
{ NID_X9_62_characteristic_two_field,0,30,4 },
......@@ -1014,6 +1049,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+30*6]; }
0xB6,0xE9,0x1F,0x1C,0x1D,0xA8,0x00,0xE4,0x78,0xA5 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+36*6]; }
_EC_NIST_CHAR2_283K = {
{ NID_X9_62_characteristic_two_field,0,36,4 },
......@@ -1044,6 +1080,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+36*6]; }
0x1E,0x06,0x1E,0x16,0x3C,0x61 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+36*6]; }
_EC_NIST_CHAR2_283B = {
{ NID_X9_62_characteristic_two_field,20,36,2 },
......@@ -1076,6 +1113,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+36*6]; }
0x2A,0x7C,0xEF,0xAD,0xB3,0x07 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+52*6]; }
_EC_NIST_CHAR2_409K = {
{ NID_X9_62_characteristic_two_field,0,52,4 },
......@@ -1118,6 +1156,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+52*6]; }
0x5F,0xCF }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+52*6]; }
_EC_NIST_CHAR2_409B = {
{ NID_X9_62_characteristic_two_field,20,52,2 },
......@@ -1162,6 +1201,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+52*6]; }
0x11,0x73 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+72*6]; }
_EC_NIST_CHAR2_571K = {
{ NID_X9_62_characteristic_two_field,0,72,4 },
......@@ -1216,6 +1256,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+72*6]; }
0x10,0x01 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+72*6]; }
_EC_NIST_CHAR2_571B = {
{ NID_X9_62_characteristic_two_field,20,72,2 },
......@@ -1272,6 +1313,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+72*6]; }
0x4E,0x47 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
_EC_X9_62_CHAR2_163V1 = {
{ NID_X9_62_characteristic_two_field,20,21,2 },
......@@ -1298,6 +1340,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
0xC1 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
_EC_X9_62_CHAR2_163V2 = {
{ NID_X9_62_characteristic_two_field,20,21,2 },
......@@ -1324,6 +1367,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
0xA7 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
_EC_X9_62_CHAR2_163V3 = {
{ NID_X9_62_characteristic_two_field,20,21,2 },
......@@ -1350,6 +1394,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+21*6]; }
0x09 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+23*6]; }
_EC_X9_62_CHAR2_176V1 = {
{ NID_X9_62_characteristic_two_field,0,23,0xFF6E },
......@@ -1374,6 +1419,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+23*6]; }
0xFE,0x26,0xAD }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_X9_62_CHAR2_191V1 = {
{ NID_X9_62_characteristic_two_field,20,24,2 },
......@@ -1400,6 +1446,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0x93,0xBB,0xB9,0xA5 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_X9_62_CHAR2_191V2 = {
{ NID_X9_62_characteristic_two_field,20,24,4 },
......@@ -1426,6 +1473,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0xE0,0x6B,0x81,0x73 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
_EC_X9_62_CHAR2_191V3 = {
{ NID_X9_62_characteristic_two_field,20,24,6 },
......@@ -1452,6 +1500,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+24*6]; }
0x28,0x8A,0x3E,0xA3 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+27*6]; }
_EC_X9_62_CHAR2_208W1 = {
{ NID_X9_62_characteristic_two_field,0,27,0xFE48 },
......@@ -1476,6 +1525,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+27*6]; }
0xBD,0xD5,0x71,0x7E,0x21,0x2F,0x9D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_CHAR2_239V1 = {
{ NID_X9_62_characteristic_two_field,20,30,4 },
......@@ -1507,6 +1557,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0x49,0x2A,0x49,0x93,0xF1,0xCA,0xD6,0x66,0xE4,0x47 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_CHAR2_239V2 = {
{ NID_X9_62_characteristic_two_field,20,30,6 },
......@@ -1538,6 +1589,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0x9C,0x31,0xE3,0xFC,0xDF,0x15,0x46,0x24,0x52,0x2D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
_EC_X9_62_CHAR2_239V3 = {
{ NID_X9_62_characteristic_two_field,20,30,0xA },
......@@ -1569,6 +1621,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+30*6]; }
0xDF,0x90,0x3E,0xF9,0x88,0x8B,0x8A,0x0E,0x4C,0xFF }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+35*6]; }
_EC_X9_62_CHAR2_272W1 = {
{ NID_X9_62_characteristic_two_field,0,35,0xFF06 },
......@@ -1599,6 +1652,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+35*6]; }
0x8F,0x1E,0x62,0x95,0x21 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+39*6]; }
_EC_X9_62_CHAR2_304W1 = {
{ NID_X9_62_characteristic_two_field,0,39,0xFE2E },
......@@ -1629,6 +1683,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+39*6]; }
0x61,0xDA,0x68,0x99,0x16,0x44,0x43,0x05,0x1D }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[20+45*6]; }
_EC_X9_62_CHAR2_359V1 = {
{ NID_X9_62_characteristic_two_field,20,45,0x4C },
......@@ -1667,6 +1722,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[20+45*6]; }
0xF4,0x90,0x75,0x8D,0x3B }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+47*6]; }
_EC_X9_62_CHAR2_368W1 = {
{ NID_X9_62_characteristic_two_field,0,47,0xFF70 },
......@@ -1703,6 +1759,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+47*6]; }
0x31,0xE9,0xCF,0xCE,0x5B,0xD9,0x67 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+54*6]; }
_EC_X9_62_CHAR2_431R1 = {
{ NID_X9_62_characteristic_two_field,0,54,0x2760 },
......@@ -1745,6 +1802,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+54*6]; }
0xC1,0xAD,0x4A,0x91 }
};
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
_EC_WTLS_1 = {
{ NID_X9_62_characteristic_two_field,0,15,2 },
......@@ -1769,6 +1827,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+15*6]; }
* As the group order is not a prime this curve is not suitable
* for ECDSA.
*/
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+20*6]; }
_EC_IPSEC_155_ID3 = {
{ NID_X9_62_characteristic_two_field,0,20,3 },
......@@ -1797,6 +1856,7 @@ static const struct { EC_CURVE_DATA h; unsigned char data[0+20*6]; }
* As the group order is not a prime this curve is not suitable
* for ECDSA.
*/
__fips_constseg
static const struct { EC_CURVE_DATA h; unsigned char data[0+24*6]; }
_EC_IPSEC_185_ID4 = {
{ NID_X9_62_characteristic_two_field,0,24,2 },
......
......@@ -70,6 +70,7 @@
#include "ec_lcl.h"
__fips_constseg
static const char EC_version[] = "EC" OPENSSL_VERSION_PTEXT;
......
......@@ -148,6 +148,7 @@ static void gcm_gmult_8bit(u64 Xi[2], const u128 Htable[256])
const u8 *xi = (const u8 *)Xi+15;
size_t rem, n = *xi;
const union { long one; char little; } is_endian = {1};
__fips_constseg
static const size_t rem_8bit[256] = {
PACK(0x0000), PACK(0x01C2), PACK(0x0384), PACK(0x0246),
PACK(0x0708), PACK(0x06CA), PACK(0x048C), PACK(0x054E),
......@@ -326,6 +327,7 @@ static void gcm_init_4bit(u128 Htable[16], u64 H[2])
}
#ifndef GHASH_ASM
__fips_constseg
static const size_t rem_4bit[16] = {
PACK(0x0000), PACK(0x1C20), PACK(0x3840), PACK(0x2460),
PACK(0x7080), PACK(0x6CA0), PACK(0x48C0), PACK(0x54E0),
......@@ -461,6 +463,7 @@ static void gcm_ghash_4bit(u64 Xi[2],const u128 Htable[16],
*/
u128 Hshr4[16]; /* Htable shifted right by 4 bits */
u8 Hshl4[16]; /* Htable shifted left by 4 bits */
__fips_constseg
static const unsigned short rem_8bit[256] = {
0x0000, 0x01C2, 0x0384, 0x0246, 0x0708, 0x06CA, 0x048C, 0x054E,
0x0E10, 0x0FD2, 0x0D94, 0x0C56, 0x0918, 0x08DA, 0x0A9C, 0x0B5E,
......
......@@ -71,6 +71,7 @@
#include <openssl/fips.h>
#endif
__fips_constseg
static const unsigned char zeroes[] = {0,0,0,0,0,0,0,0};
#if defined(_MSC_VER) && defined(_ARM_)
......
......@@ -65,6 +65,7 @@
#include <openssl/opensslv.h>
__fips_constseg
const char SHA1_version[]="SHA1" OPENSSL_VERSION_PTEXT;
/* The implementation is in ../md32_common.h */
......
......@@ -14,6 +14,7 @@
#include <openssl/sha.h>
#include <openssl/opensslv.h>
__fips_constseg
const char SHA256_version[]="SHA-256" OPENSSL_VERSION_PTEXT;
int SHA224_Init (SHA256_CTX *c)
......@@ -115,6 +116,7 @@ void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num);
#include "md32_common.h"
#ifndef SHA256_ASM
__fips_constseg
static const SHA_LONG K256[64] = {
0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
......
......@@ -50,6 +50,7 @@
#include "cryptlib.h"
__fips_constseg
const char SHA512_version[]="SHA-512" OPENSSL_VERSION_PTEXT;
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
......@@ -261,6 +262,7 @@ unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md)
}
#ifndef SHA512_ASM
__fips_constseg
static const SHA_LONG64 K512[80] = {
U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
......
......@@ -130,6 +130,7 @@ void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val)
id->val = val;
}
__fips_constseg
static const unsigned char hash_coeffs[] = { 3, 5, 7, 11, 13, 17, 19, 23 };
void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr)
{
......
......@@ -56,7 +56,8 @@
#include "fips_locl.h"
#ifdef OPENSSL_FIPS
static struct
__fips_constseg
static const struct
{
const unsigned char key[16];
const unsigned char plaintext[16];
......@@ -99,26 +100,32 @@ int FIPS_selftest_aes()
/* AES-CCM test data from NIST public test vectors */
__fips_constseg
static const unsigned char ccm_key[] = {
0xce,0xb0,0x09,0xae,0xa4,0x45,0x44,0x51,0xfe,0xad,0xf0,0xe6,
0xb3,0x6f,0x45,0x55,0x5d,0xd0,0x47,0x23,0xba,0xa4,0x48,0xe8
};
__fips_constseg
static const unsigned char ccm_nonce[] = {
0x76,0x40,0x43,0xc4,0x94,0x60,0xb7
};
__fips_constseg
static const unsigned char ccm_adata[] = {
0x6e,0x80,0xdd,0x7f,0x1b,0xad,0xf3,0xa1,0xc9,0xab,0x25,0xc7,
0x5f,0x10,0xbd,0xe7,0x8c,0x23,0xfa,0x0e,0xb8,0xf9,0xaa,0xa5,
0x3a,0xde,0xfb,0xf4,0xcb,0xf7,0x8f,0xe4
};
__fips_constseg
static const unsigned char ccm_pt[] = {
0xc8,0xd2,0x75,0xf9,0x19,0xe1,0x7d,0x7f,0xe6,0x9c,0x2a,0x1f,
0x58,0x93,0x9d,0xfe,0x4d,0x40,0x37,0x91,0xb5,0xdf,0x13,0x10
};
__fips_constseg
static const unsigned char ccm_ct[] = {
0x8a,0x0f,0x3d,0x82,0x29,0xe4,0x8e,0x74,0x87,0xfd,0x95,0xa2,
0x8a,0xd3,0x92,0xc8,0x0b,0x36,0x81,0xd4,0xfb,0xc7,0xbb,0xfd
};
__fips_constseg
static const unsigned char ccm_tag[] = {
0x2d,0xd6,0xef,0x1c,0x45,0xd4,0xcc,0xb7,0x23,0xdc,0x07,0x44,
0x14,0xdb,0x50,0x6d
......@@ -201,26 +208,32 @@ int FIPS_selftest_aes_ccm(void)
/* AES-GCM test data from NIST public test vectors */
__fips_constseg
static const unsigned char gcm_key[] = {
0xee,0xbc,0x1f,0x57,0x48,0x7f,0x51,0x92,0x1c,0x04,0x65,0x66,
0x5f,0x8a,0xe6,0xd1,0x65,0x8b,0xb2,0x6d,0xe6,0xf8,0xa0,0x69,
0xa3,0x52,0x02,0x93,0xa5,0x72,0x07,0x8f
};
__fips_constseg
static const unsigned char gcm_iv[] = {
0x99,0xaa,0x3e,0x68,0xed,0x81,0x73,0xa0,0xee,0xd0,0x66,0x84
};
__fips_constseg
static const unsigned char gcm_pt[] = {
0xf5,0x6e,0x87,0x05,0x5b,0xc3,0x2d,0x0e,0xeb,0x31,0xb2,0xea,
0xcc,0x2b,0xf2,0xa5
};
__fips_constseg
static const unsigned char gcm_aad[] = {
0x4d,0x23,0xc3,0xce,0xc3,0x34,0xb4,0x9b,0xdb,0x37,0x0c,0x43,
0x7f,0xec,0x78,0xde
};
__fips_constseg
static const unsigned char gcm_ct[] = {
0xf7,0x26,0x44,0x13,0xa8,0x4c,0x0e,0x7c,0xd5,0x36,0x86,0x7e,
0xb9,0xf2,0x17,0x36
};
__fips_constseg
static const unsigned char gcm_tag[] = {
0x67,0xba,0x05,0x10,0x26,0x2a,0xe4,0x87,0xd7,0x37,0xee,0x62,
0x98,0xf7,0x7e,0x0c
......@@ -300,24 +313,29 @@ int FIPS_selftest_aes_gcm(void)
}
__fips_constseg
static const unsigned char XTS_128_key[] = {
0xa1,0xb9,0x0c,0xba,0x3f,0x06,0xac,0x35,0x3b,0x2c,0x34,0x38,
0x76,0x08,0x17,0x62,0x09,0x09,0x23,0x02,0x6e,0x91,0x77,0x18,
0x15,0xf2,0x9d,0xab,0x01,0x93,0x2f,0x2f
};
__fips_constseg
static const unsigned char XTS_128_i[] = {
0x4f,0xae,0xf7,0x11,0x7c,0xda,0x59,0xc6,0x6e,0x4b,0x92,0x01,
0x3e,0x76,0x8a,0xd5
};
__fips_constseg
static const unsigned char XTS_128_pt[] = {
0xeb,0xab,0xce,0x95,0xb1,0x4d,0x3c,0x8d,0x6f,0xb3,0x50,0x39,
0x07,0x90,0x31,0x1c
};
__fips_constseg
static const unsigned char XTS_128_ct[] = {
0x77,0x8a,0xe8,0xb4,0x3c,0xb9,0x8d,0x5a,0x82,0x50,0x81,0xd5,
0xbe,0x47,0x1c,0x63
};
__fips_constseg
static const unsigned char XTS_256_key[] = {
0x1e,0xa6,0x61,0xc5,0x8d,0x94,0x3a,0x0e,0x48,0x01,0xe4,0x2f,
0x4b,0x09,0x47,0x14,0x9e,0x7f,0x9f,0x8e,0x3e,0x68,0xd0,0xc7,
......@@ -326,15 +344,18 @@ static const unsigned char XTS_256_key[] = {
0xd6,0x19,0xb7,0xe2,0xb9,0x14,0x1e,0x58,0x31,0x8e,0xea,0x39,
0x2c,0xf4,0x1b,0x08
};
__fips_constseg
static const unsigned char XTS_256_i[] = {
0xad,0xf8,0xd9,0x26,0x27,0x46,0x4a,0xd2,0xf0,0x42,0x8e,0x84,
0xa9,0xf8,0x75,0x64
};
__fips_constseg
static const unsigned char XTS_256_pt[] = {
0x2e,0xed,0xea,0x52,0xcd,0x82,0x15,0xe1,0xac,0xc6,0x47,0xe8,
0x10,0xbb,0xc3,0x64,0x2e,0x87,0x28,0x7f,0x8d,0x2e,0x57,0xe3,
0x6c,0x0a,0x24,0xfb,0xc1,0x2a,0x20,0x2e
};
__fips_constseg
static const unsigned char XTS_256_ct[] = {
0xcb,0xaa,0xd0,0xe2,0xf6,0xce,0xa3,0xf5,0x0b,0x37,0xf9,0x34,
0xd4,0x6a,0x9b,0x13,0x0b,0x9d,0x54,0xf0,0x7e,0x34,0xf3,0x6a,
......
......@@ -64,6 +64,7 @@ typedef struct {
} CMAC_KAT;
/* from http://csrc.nist.gov/publications/nistpubs/800-38B/SP_800-38B.pdf */
__fips_constseg
static const CMAC_KAT vector[] = {
{ NID_aes_128_cbc, /* Count = 32 from CMACGenAES128.txt */
{ 0x77,0xa7,0x7f,0xaf, 0x29,0x0c,0x1f,0xa3,
......
......@@ -57,7 +57,8 @@
#ifdef OPENSSL_FIPS
static struct
__fips_constseg
static const struct
{
const unsigned char key[24];
const unsigned char plaintext[8];
......
......@@ -60,6 +60,7 @@
#ifdef OPENSSL_FIPS
__fips_constseg
static const unsigned char dsa_test_2048_p[] = {
0xa8,0x53,0x78,0xd8,0xfd,0x3f,0x8d,0x72,0xec,0x74,0x18,0x08,
0x0d,0xa2,0x13,0x17,0xe4,0x3e,0xc4,0xb6,0x2b,0xa8,0xc8,0x62,
......@@ -84,11 +85,13 @@ static const unsigned char dsa_test_2048_p[] = {
0x2c,0x8d,0x74,0x69,0xdb,0x02,0xe2,0x4d,0x59,0x23,0x94,0xa7,
0xdb,0xa0,0x69,0xe9
};
__fips_constseg
static const unsigned char dsa_test_2048_q[] = {
0xd2,0x77,0x04,0x4e,0x50,0xf5,0xa4,0xe3,0xf5,0x10,0xa5,0x0a,
0x0b,0x84,0xfd,0xff,0xbc,0xa0,0x47,0xed,0x27,0x60,0x20,0x56,
0x74,0x41,0xa0,0xa5
};
__fips_constseg
static const unsigned char dsa_test_2048_g[] = {
0x13,0xd7,0x54,0xe2,0x1f,0xd2,0x41,0x65,0x5d,0xa8,0x91,0xc5,
0x22,0xa6,0x5a,0x72,0xa8,0x9b,0xdc,0x64,0xec,0x9b,0x54,0xa8,
......@@ -114,6 +117,7 @@ static const unsigned char dsa_test_2048_g[] = {
0xb3,0xc2,0xa9,0x66
};
__fips_constseg
static const unsigned char dsa_test_2048_pub_key[] = {
0x24,0x52,0xf3,0xcc,0xbe,0x9e,0xd5,0xca,0x7d,0xc7,0x4c,0x60,
0x2b,0x99,0x22,0x6e,0x8f,0x2f,0xab,0x38,0xe7,0xd7,0xdd,0xfb,
......@@ -138,6 +142,7 @@ static const unsigned char dsa_test_2048_pub_key[] = {
0x0a,0xcb,0x67,0x37,0x17,0xa0,0xd2,0xfb,0x3b,0x50,0xc8,0x93,
0xf7,0xda,0xb1,0x4f
};
__fips_constseg
static const unsigned char dsa_test_2048_priv_key[] = {
0x0c,0x4b,0x30,0x89,0xd1,0xb8,0x62,0xcb,0x3c,0x43,0x64,0x91,
0xf0,0x91,0x54,0x70,0xc5,0x27,0x96,0xe3,0xac,0xbe,0xe8,0x00,
......
......@@ -140,8 +140,10 @@ static unsigned char out_g[] = {
};
__fips_constseg
static const unsigned char str1[]="12345678901234567890";
__fips_constseg
static const char rnd_seed[] = "string to make the random number generator think it has entropy";
int main(int argc, char **argv)
......
......@@ -65,18 +65,22 @@
#ifdef OPENSSL_FIPS
__fips_constseg
static const char P_224_name[] = "ECDSA P-224";
__fips_constseg
static const unsigned char P_224_d[] = {
0x98,0x1f,0xb5,0xf1,0xfc,0x87,0x1d,0x7d,0xde,0x1e,0x01,0x64,
0x09,0x9b,0xe7,0x1b,0x9f,0xad,0x63,0xdd,0x33,0x01,0xd1,0x50,
0x80,0x93,0x50,0x30
};
__fips_constseg
static const unsigned char P_224_qx[] = {
0x95,0x47,0x99,0x44,0x29,0x8f,0x51,0x39,0xe2,0x53,0xec,0x79,
0xb0,0x4d,0xde,0x87,0x1a,0x76,0x54,0xd5,0x96,0xb8,0x7a,0x6d,
0xf4,0x1c,0x2c,0x87
};
__fips_constseg
static const unsigned char P_224_qy[] = {
0x91,0x5f,0xd5,0x31,0xdd,0x24,0xe5,0x78,0xd9,0x08,0x24,0x8a,
0x49,0x99,0xec,0x55,0xf2,0x82,0xb3,0xc4,0xb7,0x33,0x68,0xe4,
......@@ -85,18 +89,22 @@ static const unsigned char P_224_qy[] = {
#ifndef OPENSSL_NO_EC2M
__fips_constseg
static const char K_233_name[] = "ECDSA K-233";
__fips_constseg
static const unsigned char K_233_d[] = {
0x10,0x0a,0xe0,0xae,0xcf,0x1b,0xa4,0x55,0x1a,0xd4,0xc8,0x3f,
0xc3,0x7e,0xdc,0x97,0x40,0x2c,0x6a,0xc8,0xe2,0x50,0x09,0xf8,
0x1c,0x70,0x23,0xcb,0xde
};
__fips_constseg
static const unsigned char K_233_qx[] = {
0x01,0xa6,0xbf,0x38,0x32,0xe2,0xd7,0x15,0x4a,0xc8,0xaa,0x1f,
0x9d,0xdb,0xb8,0x8f,0x9a,0x9b,0xc0,0xb4,0xc1,0xb6,0xa5,0x5c,
0x93,0xb9,0x8a,0x83,0x65,0xe9
};
__fips_constseg
static const unsigned char K_233_qy[] = {
0x01,0x81,0x3d,0xfe,0x38,0x56,0x8f,0x3c,0x23,0x29,0xc6,0x59,
0xcb,0xa5,0x90,0x86,0xd1,0x8c,0xd8,0xb0,0xf2,0xd4,0x35,0x2b,
......
......@@ -145,6 +145,7 @@ void fips_set_selftest_fail(void)
extern const void *FIPS_text_start(), *FIPS_text_end();
extern const unsigned char FIPS_rodata_start[], FIPS_rodata_end[];
unsigned char FIPS_signature [20] = { 0 };
__fips_constseg
static const char FIPS_hmac_key[]="etaonrishdlcupfm";
unsigned int FIPS_incore_fingerprint(unsigned char *sig,unsigned int len)
......
......@@ -56,6 +56,10 @@ static void *instruction_pointer_xlc(void);
* reference points accordingly. In case you wonder, the values are
* big-endian encoded variable names, just to prevent these arrays
* from being merged by linker. */
# if defined(_MSC_VER) && defined(_WIN64)
# pragma section("fipsro$a",read)
__declspec(allocate("fipsro$a"))
# endif
const unsigned int FIPS_rodata_start[]=
{ 0x46495053, 0x5f726f64, 0x6174615f, 0x73746172 };
#else
......@@ -63,6 +67,10 @@ const unsigned int FIPS_rodata_start[]=
# ifdef FIPS_REF_POINT_IS_CROSS_COMPILER_AWARE
# define instruction_pointer FIPS_text_endX
# endif
# if defined(_MSC_VER) && defined(_WIN64)
# pragma section("fipsro$c",read)
__declspec(allocate("fipsro$c"))
# endif
const unsigned int FIPS_rodata_end[]=
{ 0x46495053, 0x5f726f64, 0x6174615f, 0x656e645b };
#endif
......
......@@ -209,6 +209,7 @@ int fips_pkey_signature_test(int id, EVP_PKEY *pkey,
int ret = 0;
unsigned char *sig = NULL;
unsigned int siglen;
__fips_constseg
static const unsigned char str1[]="12345678901234567890";
DSA_SIG *dsig = NULL;
ECDSA_SIG *esig = NULL;
......
......@@ -666,3 +666,10 @@
#define _sparcv9_vis1_instrument _fips_sparcv9_vis1_instrument
#define bn_mul_mont_gather5 fips_bn_mul_mont_gather5
#define bn_scatter5 fips_bn_scatter5
#if defined(_MSC_VER) && defined(_WIN64)
# pragma section("fipsro$b",read)
# define __fips_constseg __declspec(allocate("fipsro$b"))
#else
# define __fips_constseg
#endif
......@@ -63,15 +63,18 @@ typedef struct {
/* from http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf */
/* "0123456789:;<=>?@ABC" */
__fips_constseg
const unsigned char hmac_kat_key[] = {
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a,
0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43
};
/* "Sample #2" */
__fips_constseg
const unsigned char hmac_kat_data[] = {
0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x23, 0x32
};
__fips_constseg
static const HMAC_KAT vector[] = {
{ NID_sha1,
{ 0x09,0x22,0xd3,0x40,0x5f,0xaa,0x3d,0x19,
......
......@@ -392,23 +392,27 @@ static int drbg_ec_uninstantiate(DRBG_CTX *dctx)
/* Q points from SP 800-90 A.1, P is generator */
__fips_constseg
static const unsigned char p_256_qx[] = {
0xc9,0x74,0x45,0xf4,0x5c,0xde,0xf9,0xf0,0xd3,0xe0,0x5e,0x1e,
0x58,0x5f,0xc2,0x97,0x23,0x5b,0x82,0xb5,0xbe,0x8f,0xf3,0xef,
0xca,0x67,0xc5,0x98,0x52,0x01,0x81,0x92
};
__fips_constseg
static const unsigned char p_256_qy[] = {
0xb2,0x8e,0xf5,0x57,0xba,0x31,0xdf,0xcb,0xdd,0x21,0xac,0x46,
0xe2,0xa9,0x1e,0x3c,0x30,0x4f,0x44,0xcb,0x87,0x05,0x8a,0xda,
0x2c,0xb8,0x15,0x15,0x1e,0x61,0x00,0x46
};
__fips_constseg
static const unsigned char p_384_qx[] = {
0x8e,0x72,0x2d,0xe3,0x12,0x5b,0xdd,0xb0,0x55,0x80,0x16,0x4b,
0xfe,0x20,0xb8,0xb4,0x32,0x21,0x6a,0x62,0x92,0x6c,0x57,0x50,
0x2c,0xee,0xde,0x31,0xc4,0x78,0x16,0xed,0xd1,0xe8,0x97,0x69,
0x12,0x41,0x79,0xd0,0xb6,0x95,0x10,0x64,0x28,0x81,0x50,0x65
};
__fips_constseg
static const unsigned char p_384_qy[] = {
0x02,0x3b,0x16,0x60,0xdd,0x70,0x1d,0x08,0x39,0xfd,0x45,0xee,
0xc3,0x6f,0x9e,0xe7,0xb3,0x2e,0x13,0xb3,0x15,0xdc,0x02,0x61,
......@@ -416,6 +420,7 @@ static const unsigned char p_384_qy[] = {
0xc5,0xe0,0x9b,0x05,0x67,0x4d,0xbb,0x7e,0x45,0xc8,0x03,0xdd
};
__fips_constseg
static const unsigned char p_521_qx[] = {
0x01,0xb9,0xfa,0x3e,0x51,0x8d,0x68,0x3c,0x6b,0x65,0x76,0x36,
0x94,0xac,0x8e,0xfb,0xae,0xc6,0xfa,0xb4,0x4f,0x22,0x76,0x17,
......@@ -424,6 +429,7 @@ static const unsigned char p_521_qx[] = {
0x3b,0x24,0xc3,0xed,0xfa,0x0f,0x85,0xfe,0x24,0xd0,0xc8,0xc0,
0x15,0x91,0xf0,0xbe,0x6f,0x63
};
__fips_constseg
static const unsigned char p_521_qy[] = {
0x01,0xf3,0xbd,0xba,0x58,0x52,0x95,0xd9,0xa1,0x11,0x0d,0x1d,
0xf1,0xf9,0x43,0x0e,0xf8,0x44,0x2c,0x50,0x18,0x97,0x6f,0xf3,
......
此差异已折叠。
......@@ -137,11 +137,13 @@ typedef struct
unsigned char R[16];
} AES_PRNG_MCT;
static unsigned char aes_128_mct_key[16] =
__fips_constseg
static const unsigned char aes_128_mct_key[16] =
{0x9f,0x5b,0x51,0x20,0x0b,0xf3,0x34,0xb5,
0xd8,0x2b,0xe8,0xc3,0x72,0x55,0xc8,0x48};
static AES_PRNG_MCT aes_128_mct_tv = {
__fips_constseg
static const AES_PRNG_MCT aes_128_mct_tv = {
/* DT */
{0x63,0x76,0xbb,0xe5,0x29,0x02,0xba,0x3b,
0x67,0xc9,0x25,0xfa,0x70,0x1f,0x11,0xac},
......@@ -153,12 +155,14 @@ static AES_PRNG_MCT aes_128_mct_tv = {
0xe4,0x57,0x90,0xd5,0xc3,0xfc,0x9b,0x73}
};
static unsigned char aes_192_mct_key[24] =
__fips_constseg
static const unsigned char aes_192_mct_key[24] =
{0xb7,0x6c,0x34,0xd1,0x09,0x67,0xab,0x73,
0x4d,0x5a,0xd5,0x34,0x98,0x16,0x0b,0x91,
0xbc,0x35,0x51,0x16,0x6b,0xae,0x93,0x8a};
static AES_PRNG_MCT aes_192_mct_tv = {
__fips_constseg
static const AES_PRNG_MCT aes_192_mct_tv = {
/* DT */
{0x84,0xce,0x22,0x7d,0x91,0x5a,0xa3,0xc9,
0x84,0x3c,0x0a,0xb3,0xa9,0x63,0x15,0x52},
......@@ -170,13 +174,15 @@ static AES_PRNG_MCT aes_192_mct_tv = {
0xdd,0x86,0x20,0x32,0x8a,0x29,0x6f,0x47}
};
static unsigned char aes_256_mct_key[32] =
__fips_constseg
static const unsigned char aes_256_mct_key[32] =
{0x9b,0x05,0xc8,0x68,0xff,0x47,0xf8,0x3a,
0xa6,0x3a,0xa8,0xcb,0x4e,0x71,0xb2,0xe0,
0xb8,0x7e,0xf1,0x37,0xb6,0xb4,0xf6,0x6d,
0x86,0x32,0xfc,0x1f,0x5e,0x1d,0x1e,0x50};
static AES_PRNG_MCT aes_256_mct_tv = {
__fips_constseg
static const AES_PRNG_MCT aes_256_mct_tv = {
/* DT */
{0x31,0x6e,0x35,0x9a,0xb1,0x44,0xf0,0xee,
0x62,0x6d,0x04,0x46,0xe0,0xa3,0x92,0x4c},
......
......@@ -61,6 +61,7 @@
#ifdef OPENSSL_FIPS
__fips_constseg
static const unsigned char rsa_test_2048_n[] = {
0xDB,0x10,0x1A,0xC2,0xA3,0xF1,0xDC,0xFF,0x13,0x6B,0xED,0x44,
0xDF,0xF0,0x02,0x6D,0x13,0xC7,0x88,0xDA,0x70,0x6B,0x54,0xF1,
......@@ -85,9 +86,11 @@ static const unsigned char rsa_test_2048_n[] = {
0xD6,0xB0,0xE2,0x62,0x8F,0x74,0x26,0xC2,0x0C,0xD3,0x9A,0x17,
0x47,0xE6,0x8E,0xAB
};
__fips_constseg
static const unsigned char rsa_test_2048_e[] = {
0x01,0x00,0x01
};
__fips_constseg
static const unsigned char rsa_test_2048_d[] = {
0x52,0x41,0xF4,0xDA,0x7B,0xB7,0x59,0x55,0xCA,0xD4,0x2F,0x0F,
0x3A,0xCB,0xA4,0x0D,0x93,0x6C,0xCC,0x9D,0xC1,0xB2,0xFB,0xFD,
......@@ -112,6 +115,7 @@ static const unsigned char rsa_test_2048_d[] = {
0xA7,0x1D,0xD9,0x1E,0x06,0xCD,0xE8,0xBA,0x2C,0x8C,0x69,0x32,
0xEA,0xBE,0x60,0x71
};
__fips_constseg
static const unsigned char rsa_test_2048_p[] = {
0xFA,0xAC,0xE1,0x37,0x5E,0x32,0x11,0x34,0xC6,0x72,0x58,0x2D,
0x91,0x06,0x3E,0x77,0xE7,0x11,0x21,0xCD,0x4A,0xF8,0xA4,0x3F,
......@@ -125,6 +129,7 @@ static const unsigned char rsa_test_2048_p[] = {
0x0A,0x3B,0xB3,0xAF,0xE2,0x75,0x36,0x04,0xAC,0x56,0xA0,0xAB,
0x52,0xDE,0xCE,0xDD,0x2C,0x28,0x77,0x03
};
__fips_constseg
static const unsigned char rsa_test_2048_q[] = {
0xDF,0xB7,0x52,0xB6,0xD7,0xC0,0xE2,0x96,0xE7,0xC9,0xFE,0x5D,
0x71,0x5A,0xC4,0x40,0x96,0x2F,0xE5,0x87,0xEA,0xF3,0xA5,0x77,
......@@ -138,6 +143,7 @@ static const unsigned char rsa_test_2048_q[] = {
0x5B,0x74,0x69,0x73,0x87,0x95,0x05,0x07,0xBE,0x45,0x07,0x17,
0x7E,0x4A,0x69,0x22,0xF3,0xDB,0x05,0x39
};
__fips_constseg
static const unsigned char rsa_test_2048_dmp1[] = {
0x5E,0xD8,0xDC,0xDA,0x53,0x44,0xC4,0x67,0xE0,0x92,0x51,0x34,
0xE4,0x83,0xA5,0x4D,0x3E,0xDB,0xA7,0x9B,0x82,0xBB,0x73,0x81,
......@@ -151,6 +157,7 @@ static const unsigned char rsa_test_2048_dmp1[] = {
0xE7,0x42,0x51,0xA9,0xC2,0x18,0xB1,0x58,0xB1,0x50,0x91,0xB8,
0x61,0x41,0xB6,0xA9,0xCE,0xD4,0x7C,0xBB
};
__fips_constseg
static const unsigned char rsa_test_2048_dmq1[] = {
0x54,0x09,0x1F,0x0F,0x03,0xD8,0xB6,0xC5,0x0C,0xE8,0xB9,0x9E,
0x0C,0x38,0x96,0x43,0xD4,0xA6,0xC5,0x47,0xDB,0x20,0x0E,0xE5,
......@@ -164,6 +171,7 @@ static const unsigned char rsa_test_2048_dmq1[] = {
0x1C,0x7B,0x8C,0x29,0x13,0xA3,0x0C,0xB2,0xAD,0xEC,0x6C,0x0F,
0x8D,0x27,0x12,0x7B,0x48,0xB2,0xDB,0x31
};
__fips_constseg
static const unsigned char rsa_test_2048_iqmp[] = {
0x8D,0x1B,0x05,0xCA,0x24,0x1F,0x0C,0x53,0x19,0x52,0x74,0x63,
0x21,0xFA,0x78,0x46,0x79,0xAF,0x5C,0xDE,0x30,0xA4,0x6C,0x20,
......@@ -197,8 +205,10 @@ static int setrsakey(RSA *k)
* kat_tbs.
*/
__fips_constseg
static const unsigned char kat_tbs[] = "OpenSSL FIPS 140-2 Public Key RSA KAT";
__fips_constseg
static const unsigned char kat_RSA_PSS_SHA256[] = {
0x51,0x4F,0x0B,0x8A,0xE6,0x7F,0xF0,0x39,0x9B,0x5F,0x21,0x26,
0x99,0x71,0xDC,0x64,0x5A,0x60,0x9B,0xFB,0xB9,0x48,0xE3,0xD4,
......
......@@ -74,26 +74,31 @@
/* Standard encodings including NULL parameter */
__fips_constseg
static const unsigned char sha1_bin[] = {
0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05,
0x00, 0x04, 0x14
};
__fips_constseg
static const unsigned char sha224_bin[] = {
0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x04, 0x05, 0x00, 0x04, 0x1c
};
__fips_constseg
static const unsigned char sha256_bin[] = {
0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20
};
__fips_constseg
static const unsigned char sha384_bin[] = {
0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30
};
__fips_constseg
static const unsigned char sha512_bin[] = {
0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40
......@@ -103,27 +108,32 @@ static const unsigned char sha512_bin[] = {
* using this format but do tolerate received signatures of this form.
*/
static unsigned char sha1_nn_bin[] = {
__fips_constseg
static const unsigned char sha1_nn_bin[] = {
0x30, 0x1f, 0x30, 0x07, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x04,
0x14
};
static unsigned char sha224_nn_bin[] = {
__fips_constseg
static const unsigned char sha224_nn_bin[] = {
0x30, 0x2b, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x04, 0x04, 0x1c
};
static unsigned char sha256_nn_bin[] = {
__fips_constseg
static const unsigned char sha256_nn_bin[] = {
0x30, 0x2f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x01, 0x04, 0x20
};
static unsigned char sha384_nn_bin[] = {
__fips_constseg
static const unsigned char sha384_nn_bin[] = {
0x30, 0x3f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x02, 0x04, 0x30
};
static unsigned char sha512_nn_bin[] = {
__fips_constseg
static const unsigned char sha512_nn_bin[] = {
0x30, 0x4f, 0x30, 0x0b, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03,
0x04, 0x02, 0x03, 0x04, 0x40
};
......
......@@ -63,6 +63,7 @@ static const unsigned char test[][60]=
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
};
__fips_constseg
static const unsigned char ret[][SHA_DIGEST_LENGTH]=
{
{ 0xda,0x39,0xa3,0xee,0x5e,0x6b,0x4b,0x0d,0x32,0x55,
......
......@@ -162,7 +162,7 @@ $app_cflag.=" /Zi /Fd\$(TMP_D)/app";
$lib_cflag.=" /Zi /Fd\$(TMP_D)/lib";
$lflags.=" /debug";
$lflags.=" /fixed" if $fips;
$lflags.=" /fixed" if ($fips && $FLAVOR !~ /WIN64/);
$obj='.obj';
$asm_suffix='.asm';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册