summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Thomson <mt@lowentropy.net>2019-10-28 22:55:09 +0000
committerMartin Thomson <mt@lowentropy.net>2019-10-28 22:55:09 +0000
commit021a5d411267b3fc51fac4034452e2a74306c45d (patch)
tree41d290ec762fcc28095fcdef4510679f8f87e5ea
parentea541a79dd10a11fbcd861101ebe3d49aa5c8814 (diff)
downloadnss-hg-021a5d411267b3fc51fac4034452e2a74306c45d.tar.gz
Bug 1590972 - Use -std=c99 for all C code, r=jcj
This switches to using -std=c99 for compiling all C code. Previously, we only enabled this option for lib/freebl and lib/ssl. For Linux, this means we need to define _DEFAULT_SOURCE to access some of the functions we use. On glibc 2.12 (our oldest supported version), we also need to define _BSD_SOURCE to access these functions. The only tricky part is dealing with partial C99 implementation in gcc 4.4. From what I've seen, the only problem is that - in that mode - it doesn't support nesting of unnamed fields: https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Unnamed-Fields.html This also switches from -std=c++0x to -std=c++11 as the 0x variant, though identical in meaning, is deprecated. Differential Revision: https://phabricator.services.mozilla.com/D50421
-rw-r--r--coreconf/Linux.mk1
-rw-r--r--coreconf/WIN32.mk6
-rw-r--r--coreconf/command.mk2
-rw-r--r--coreconf/config.gypi7
-rw-r--r--coreconf/rules.mk34
-rw-r--r--lib/freebl/aes-armv8.c24
-rw-r--r--lib/freebl/aes-x86.c12
-rw-r--r--lib/freebl/config.mk5
-rw-r--r--lib/freebl/freebl.gyp17
-rw-r--r--lib/freebl/intel-aes.h34
-rw-r--r--lib/freebl/intel-gcm-wrap.c2
-rw-r--r--lib/freebl/rijndael.c10
-rw-r--r--lib/freebl/rijndael.h2
-rw-r--r--lib/ssl/config.mk4
-rw-r--r--lib/ssl/ssl.gyp5
15 files changed, 74 insertions, 91 deletions
diff --git a/coreconf/Linux.mk b/coreconf/Linux.mk
index d321284d3..d07f8a3c5 100644
--- a/coreconf/Linux.mk
+++ b/coreconf/Linux.mk
@@ -21,6 +21,7 @@ ifeq ($(USE_PTHREADS),1)
endif
DEFAULT_COMPILER = gcc
+DEFINES += -D_DEFAULT_SOURCE -D_BSD_SOURCE
ifeq ($(OS_TARGET),Android)
ifndef ANDROID_NDK
diff --git a/coreconf/WIN32.mk b/coreconf/WIN32.mk
index 7269cc7a2..ac1a454bc 100644
--- a/coreconf/WIN32.mk
+++ b/coreconf/WIN32.mk
@@ -261,6 +261,12 @@ else
endif
endif
+# clear any CSTD and CXXSTD unless we're using GCC
+ifndef NS_USE_GCC
+ CSTD =
+ CXXSTD =
+endif
+
#
# override the definitions of RELEASE_TREE found in tree.mk
#
diff --git a/coreconf/command.mk b/coreconf/command.mk
index 5e92748aa..a89252056 100644
--- a/coreconf/command.mk
+++ b/coreconf/command.mk
@@ -14,6 +14,8 @@ CCF = $(CC) $(CFLAGS)
LINK_DLL = $(LD) $(OS_DLLFLAGS) $(DLLFLAGS) $(XLDFLAGS)
CFLAGS = $(OPTIMIZER) $(OS_CFLAGS) $(WARNING_CFLAGS) $(XP_DEFINE) \
$(DEFINES) $(INCLUDES) $(XCFLAGS)
+CSTD = -std=c99
+CXXSTD = -std=c++11
PERL = perl
RANLIB = echo
TAR = /bin/tar
diff --git a/coreconf/config.gypi b/coreconf/config.gypi
index f4426ac32..3b049111a 100644
--- a/coreconf/config.gypi
+++ b/coreconf/config.gypi
@@ -355,6 +355,8 @@
'LINUX2_1',
'LINUX',
'linux',
+ '_DEFAULT_SOURCE', # for <endian.h> functions, strdup, realpath, and getentropy
+ '_BSD_SOURCE', # for the above in glibc <= 2.19
],
}],
[ 'OS=="dragonfly" or OS=="freebsd"', {
@@ -391,8 +393,11 @@
'-ffunction-sections',
'-fdata-sections',
],
+ 'cflags_c': [
+ '-std=c99',
+ ],
'cflags_cc': [
- '-std=c++0x',
+ '-std=c++11',
],
'ldflags': [
'-z', 'noexecstack',
diff --git a/coreconf/rules.mk b/coreconf/rules.mk
index 3a8013529..acf4fcc62 100644
--- a/coreconf/rules.mk
+++ b/coreconf/rules.mk
@@ -391,23 +391,23 @@ core_abspath = '$(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD
$(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
@$(MAKE_OBJDIR)
ifdef USE_NT_C_SYNTAX
- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
+ $(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
else
ifdef NEED_ABSOLUTE_PATH
- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
+ $(CC) -o $@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
else
- $(CC) -o $@ -c $(CFLAGS) $<
+ $(CC) -o $@ -c $(CSTD) $(CFLAGS) $<
endif
endif
$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
ifdef USE_NT_C_SYNTAX
- $(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
+ $(CC) -Fo$@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
else
ifdef NEED_ABSOLUTE_PATH
- $(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
+ $(CC) -o $@ -c $(CSTD) $(CFLAGS) $(call core_abspath,$<)
else
- $(CC) -o $@ -c $(CFLAGS) $<
+ $(CC) -o $@ -c $(CSTD) $(CFLAGS) $<
endif
endif
@@ -428,12 +428,12 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.S
$(OBJDIR)/$(PROG_PREFIX)%: %.cpp
@$(MAKE_OBJDIR)
ifdef USE_NT_C_SYNTAX
- $(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
ifdef NEED_ABSOLUTE_PATH
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
endif
endif
@@ -444,16 +444,16 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cc
$(MAKE_OBJDIR)
ifdef STRICT_CPLUSPLUS_SUFFIX
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
rm -f $(OBJDIR)/t_$*.cc
else
ifdef USE_NT_C_SYNTAX
- $(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
ifdef NEED_ABSOLUTE_PATH
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
endif
endif
endif #STRICT_CPLUSPLUS_SUFFIX
@@ -462,16 +462,16 @@ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.cpp
@$(MAKE_OBJDIR)
ifdef STRICT_CPLUSPLUS_SUFFIX
echo "#line 1 \"$<\"" | cat - $< > $(OBJDIR)/t_$*.cc
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(OBJDIR)/t_$*.cc
rm -f $(OBJDIR)/t_$*.cc
else
ifdef USE_NT_C_SYNTAX
- $(CCC) -Fo$@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -Fo$@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
ifdef NEED_ABSOLUTE_PATH
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $(call core_abspath,$<)
else
- $(CCC) -o $@ -c $(CFLAGS) $(CXXFLAGS) $<
+ $(CCC) -o $@ -c $(CXXSTD) $(CFLAGS) $(CXXFLAGS) $<
endif
endif
endif #STRICT_CPLUSPLUS_SUFFIX
diff --git a/lib/freebl/aes-armv8.c b/lib/freebl/aes-armv8.c
index 10cb33d49..8213272f5 100644
--- a/lib/freebl/aes-armv8.c
+++ b/lib/freebl/aes-armv8.c
@@ -29,7 +29,7 @@ arm_aes_encrypt_ecb_128(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -114,7 +114,7 @@ arm_aes_decrypt_ecb_128(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (inputLen == 0) {
return SECSuccess;
@@ -200,7 +200,7 @@ arm_aes_encrypt_cbc_128(AESContext *cx, unsigned char *output,
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11;
uint8x16_t iv;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -294,7 +294,7 @@ arm_aes_decrypt_cbc_128(AESContext *cx, unsigned char *output,
uint8x16_t iv;
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -389,7 +389,7 @@ arm_aes_encrypt_ecb_192(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13;
- PRUint8 *key = (PRUint8 *)cx->expandedKey;
+ PRUint8 *key = (PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -480,7 +480,7 @@ arm_aes_decrypt_ecb_192(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -572,7 +572,7 @@ arm_aes_encrypt_cbc_192(AESContext *cx, unsigned char *output,
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13;
uint8x16_t iv;
- PRUint8 *key = (PRUint8 *)cx->expandedKey;
+ PRUint8 *key = (PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -671,7 +671,7 @@ arm_aes_decrypt_cbc_192(AESContext *cx, unsigned char *output,
uint8x16_t iv;
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -772,7 +772,7 @@ arm_aes_encrypt_ecb_256(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13, key14, key15;
- PRUint8 *key = (PRUint8 *)cx->expandedKey;
+ PRUint8 *key = (PRUint8 *)cx->k.expandedKey;
if (inputLen == 0) {
return SECSuccess;
@@ -868,7 +868,7 @@ arm_aes_decrypt_ecb_256(AESContext *cx, unsigned char *output,
#endif
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13, key14, key15;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -966,7 +966,7 @@ arm_aes_encrypt_cbc_256(AESContext *cx, unsigned char *output,
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13, key14, key15;
uint8x16_t iv;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
@@ -1072,7 +1072,7 @@ arm_aes_decrypt_cbc_256(AESContext *cx, unsigned char *output,
uint8x16_t iv;
uint8x16_t key1, key2, key3, key4, key5, key6, key7, key8, key9, key10;
uint8x16_t key11, key12, key13, key14, key15;
- const PRUint8 *key = (const PRUint8 *)cx->expandedKey;
+ const PRUint8 *key = (const PRUint8 *)cx->k.expandedKey;
if (!inputLen) {
return SECSuccess;
diff --git a/lib/freebl/aes-x86.c b/lib/freebl/aes-x86.c
index 830b4782f..edd0b5125 100644
--- a/lib/freebl/aes-x86.c
+++ b/lib/freebl/aes-x86.c
@@ -21,7 +21,7 @@
static void
native_key_expansion128(AESContext *cx, const unsigned char *key)
{
- __m128i *keySchedule = cx->keySchedule;
+ __m128i *keySchedule = cx->k.keySchedule;
pre_align __m128i tmp_key post_align;
pre_align __m128i tmp post_align;
keySchedule[0] = _mm_loadu_si128((__m128i *)key);
@@ -61,7 +61,7 @@ native_key_expansion128(AESContext *cx, const unsigned char *key)
static void
native_key_expansion192(AESContext *cx, const unsigned char *key)
{
- __m128i *keySchedule = cx->keySchedule;
+ __m128i *keySchedule = cx->k.keySchedule;
pre_align __m128i tmp1 post_align;
pre_align __m128i tmp2 post_align;
pre_align __m128i tmp3 post_align;
@@ -96,7 +96,7 @@ native_key_expansion192(AESContext *cx, const unsigned char *key)
static void
native_key_expansion256(AESContext *cx, const unsigned char *key)
{
- __m128i *keySchedule = cx->keySchedule;
+ __m128i *keySchedule = cx->k.keySchedule;
pre_align __m128i tmp_key post_align;
pre_align __m128i tmp1 post_align;
pre_align __m128i tmp2 post_align;
@@ -148,10 +148,10 @@ rijndael_native_encryptBlock(AESContext *cx,
{
int i;
pre_align __m128i m post_align = _mm_loadu_si128((__m128i *)input);
- m = _mm_xor_si128(m, cx->keySchedule[0]);
+ m = _mm_xor_si128(m, cx->k.keySchedule[0]);
for (i = 1; i < cx->Nr; ++i) {
- m = _mm_aesenc_si128(m, cx->keySchedule[i]);
+ m = _mm_aesenc_si128(m, cx->k.keySchedule[i]);
}
- m = _mm_aesenclast_si128(m, cx->keySchedule[cx->Nr]);
+ m = _mm_aesenclast_si128(m, cx->k.keySchedule[cx->Nr]);
_mm_storeu_si128((__m128i *)output, m);
}
diff --git a/lib/freebl/config.mk b/lib/freebl/config.mk
index 7ac50db65..918a66363 100644
--- a/lib/freebl/config.mk
+++ b/lib/freebl/config.mk
@@ -90,12 +90,7 @@ EXTRA_SHARED_LIBS += \
endif
endif
-ifeq (,$(filter-out DragonFly FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET)))
-CFLAGS += -std=gnu99
-endif
-
ifeq ($(OS_ARCH), Darwin)
-CFLAGS += -std=gnu99
EXTRA_SHARED_LIBS += -dylib_file @executable_path/libplc4.dylib:$(DIST)/lib/libplc4.dylib -dylib_file @executable_path/libplds4.dylib:$(DIST)/lib/libplds4.dylib
endif
diff --git a/lib/freebl/freebl.gyp b/lib/freebl/freebl.gyp
index 39506921c..f12508136 100644
--- a/lib/freebl/freebl.gyp
+++ b/lib/freebl/freebl.gyp
@@ -361,15 +361,6 @@
'MP_API_COMPATIBLE'
],
'conditions': [
- [ 'OS=="mac"', {
- 'xcode_settings': {
- # I'm not sure since when this is supported.
- # But I hope that doesn't matter. We also assume this is x86/x64.
- 'OTHER_CFLAGS': [
- '-std=gnu99',
- ],
- },
- }],
[ 'OS=="win" and target_arch=="ia32"', {
'msvs_settings': {
'VCCLCompilerTool': {
@@ -424,14 +415,6 @@
'FREEBL_LOWHASH',
'FREEBL_NO_DEPEND',
],
- 'cflags': [
- '-std=gnu99',
- ],
- }],
- [ 'OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', {
- 'cflags': [
- '-std=gnu99',
- ],
}],
[ 'OS=="linux" or OS=="android"', {
'conditions': [
diff --git a/lib/freebl/intel-aes.h b/lib/freebl/intel-aes.h
index 970f5192c..e7fe1a03b 100644
--- a/lib/freebl/intel-aes.h
+++ b/lib/freebl/intel-aes.h
@@ -123,21 +123,21 @@ SECStatus intel_aes_encrypt_ctr_256(CTRContext *cx, unsigned char *output,
: (nr) == 12 ? intel_aes_encrypt_ctr_192 \
: intel_aes_encrypt_ctr_256)
-#define native_aes_init(encrypt, keysize) \
- do { \
- if (encrypt) { \
- if (keysize == 16) \
- intel_aes_encrypt_init_128(key, cx->expandedKey); \
- else if (keysize == 24) \
- intel_aes_encrypt_init_192(key, cx->expandedKey); \
- else \
- intel_aes_encrypt_init_256(key, cx->expandedKey); \
- } else { \
- if (keysize == 16) \
- intel_aes_decrypt_init_128(key, cx->expandedKey); \
- else if (keysize == 24) \
- intel_aes_decrypt_init_192(key, cx->expandedKey); \
- else \
- intel_aes_decrypt_init_256(key, cx->expandedKey); \
- } \
+#define native_aes_init(encrypt, keysize) \
+ do { \
+ if (encrypt) { \
+ if (keysize == 16) \
+ intel_aes_encrypt_init_128(key, cx->k.expandedKey); \
+ else if (keysize == 24) \
+ intel_aes_encrypt_init_192(key, cx->k.expandedKey); \
+ else \
+ intel_aes_encrypt_init_256(key, cx->k.expandedKey); \
+ } else { \
+ if (keysize == 16) \
+ intel_aes_decrypt_init_128(key, cx->k.expandedKey); \
+ else if (keysize == 24) \
+ intel_aes_decrypt_init_192(key, cx->k.expandedKey); \
+ else \
+ intel_aes_decrypt_init_256(key, cx->k.expandedKey); \
+ } \
} while (0)
diff --git a/lib/freebl/intel-gcm-wrap.c b/lib/freebl/intel-gcm-wrap.c
index 7558ffe59..059fc6332 100644
--- a/lib/freebl/intel-gcm-wrap.c
+++ b/lib/freebl/intel-gcm-wrap.c
@@ -89,7 +89,7 @@ intel_AES_GCM_CreateContext(void *context,
gcm->Mlen = 0;
/* first prepare H and its derivatives for ghash */
- intel_aes_gcmINIT(gcm->Htbl, (unsigned char *)aes->expandedKey, aes->Nr);
+ intel_aes_gcmINIT(gcm->Htbl, (unsigned char *)aes->k.expandedKey, aes->Nr);
/* Initial TAG value is zero */
_mm_storeu_si128((__m128i *)gcm->T, _mm_setzero_si128());
diff --git a/lib/freebl/rijndael.c b/lib/freebl/rijndael.c
index 6d77d942d..fbf229aa5 100644
--- a/lib/freebl/rijndael.c
+++ b/lib/freebl/rijndael.c
@@ -331,7 +331,7 @@ rijndael_key_expansion7(AESContext *cx, const unsigned char *key, unsigned int N
PRUint32 *W;
PRUint32 *pW;
PRUint32 tmp;
- W = cx->expandedKey;
+ W = cx->k.expandedKey;
/* 1. the first Nk words contain the cipher key */
memcpy(W, key, Nk * 4);
i = Nk;
@@ -363,7 +363,7 @@ rijndael_key_expansion(AESContext *cx, const unsigned char *key, unsigned int Nk
rijndael_key_expansion7(cx, key, Nk);
return;
}
- W = cx->expandedKey;
+ W = cx->k.expandedKey;
/* The first Nk words contain the input cipher key */
memcpy(W, key, Nk * 4);
i = Nk;
@@ -440,7 +440,7 @@ rijndael_invkey_expansion(AESContext *cx, const unsigned char *key, unsigned int
/* ... but has the additional step of InvMixColumn,
* excepting the first and last round keys.
*/
- roundkeyw = cx->expandedKey + cx->Nb;
+ roundkeyw = cx->k.expandedKey + cx->Nb;
for (r = 1; r < cx->Nr; ++r) {
/* each key word, roundkeyw, represents a column in the key
* matrix. Each column is multiplied by the InvMixColumn matrix.
@@ -538,7 +538,7 @@ rijndael_encryptBlock128(AESContext *cx,
pOut = (unsigned char *)output;
}
#endif
- roundkeyw = cx->expandedKey;
+ roundkeyw = cx->k.expandedKey;
/* Step 1: Add Round Key 0 to initial state */
COLUMN_0(state) = *((PRUint32 *)(pIn)) ^ *roundkeyw++;
COLUMN_1(state) = *((PRUint32 *)(pIn + 4)) ^ *roundkeyw++;
@@ -633,7 +633,7 @@ rijndael_decryptBlock128(AESContext *cx,
pOut = (unsigned char *)output;
}
#endif
- roundkeyw = cx->expandedKey + cx->Nb * cx->Nr + 3;
+ roundkeyw = cx->k.expandedKey + cx->Nb * cx->Nr + 3;
/* reverse the final key addition */
COLUMN_3(state) = *((PRUint32 *)(pIn + 12)) ^ *roundkeyw--;
COLUMN_2(state) = *((PRUint32 *)(pIn + 8)) ^ *roundkeyw--;
diff --git a/lib/freebl/rijndael.h b/lib/freebl/rijndael.h
index 1b63a323d..61060e016 100644
--- a/lib/freebl/rijndael.h
+++ b/lib/freebl/rijndael.h
@@ -68,7 +68,7 @@ struct AESContextStr {
__m128i keySchedule[15];
#endif
PRUint32 expandedKey[RIJNDAEL_MAX_EXP_KEY_SIZE];
- };
+ } k;
unsigned int Nb;
unsigned int Nr;
freeblCipherFunc worker;
diff --git a/lib/ssl/config.mk b/lib/ssl/config.mk
index b901a8830..d13613f78 100644
--- a/lib/ssl/config.mk
+++ b/lib/ssl/config.mk
@@ -60,7 +60,3 @@ endif
ifdef NSS_DISABLE_TLS_1_3
DEFINES += -DNSS_DISABLE_TLS_1_3
endif
-
-ifeq (,$(filter-out DragonFly FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET)))
-CFLAGS += -std=gnu99
-endif
diff --git a/lib/ssl/ssl.gyp b/lib/ssl/ssl.gyp
index ae8f8d94f..3e1b5531a 100644
--- a/lib/ssl/ssl.gyp
+++ b/lib/ssl/ssl.gyp
@@ -70,11 +70,6 @@
'UNSAFE_FUZZER_MODE',
],
}],
- [ 'OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd" or OS=="linux"', {
- 'cflags': [
- '-std=gnu99',
- ],
- }],
[ 'enable_sslkeylogfile==1', {
'defines': [
'NSS_ALLOW_SSLKEYLOGFILE',