1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

aes: Fix sequence point warning

This commit is contained in:
Saleem Rashid 2017-07-31 20:58:31 +01:00 committed by Pavol Rusnak
parent ea30ebe393
commit f9ab9f828b
3 changed files with 14 additions and 11 deletions

View File

@ -7,10 +7,6 @@ add_library(TrezorCrypto STATIC ${SOURCES})
target_include_directories(TrezorCrypto PUBLIC .)
target_include_directories(TrezorCrypto PUBLIC ed25519-donna)
# disable sequence point warnings where they are expected
set_source_files_properties(aeskey.c PROPERTIES
COMPILE_FLAGS -Wno-sequence-point)
target_compile_options(TrezorCrypto PRIVATE "-std=c99")
if(MSVC)

View File

@ -24,7 +24,6 @@ CFLAGS += $(OPTFLAGS) \
-Werror
# disable sequence point warning because of AES code
CFLAGS += -Wno-sequence-point
CFLAGS += -I.
CFLAGS += -Iaes
CFLAGS += -Ichacha20poly1305

View File

@ -393,8 +393,11 @@ AES_RETURN aes_xi(decrypt_key192)(const unsigned char *key, aes_decrypt_ctx cx[1
cx->ks[v(48,(3))] = ss[3] = word_in(key, 3);
#ifdef DEC_KS_UNROLL
cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4));
cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5));
ss[4] = word_in(key, 4);
ss[5] = word_in(key, 5);
cx->ks[v(48,(4))] = ff(ss[4]);
cx->ks[v(48,(5))] = ff(ss[5]);
kdf6(cx->ks, 0); kd6(cx->ks, 1);
kd6(cx->ks, 2); kd6(cx->ks, 3);
kd6(cx->ks, 4); kd6(cx->ks, 5);
@ -485,10 +488,15 @@ AES_RETURN aes_xi(decrypt_key256)(const unsigned char *key, aes_decrypt_ctx cx[1
cx->ks[v(56,(3))] = ss[3] = word_in(key, 3);
#ifdef DEC_KS_UNROLL
cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4));
cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5));
cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6));
cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7));
ss[4] = word_in(key, 4);
ss[5] = word_in(key, 5);
ss[6] = word_in(key, 6);
ss[7] = word_in(key, 7);
cx->ks[v(56,(4))] = ff(ss[4]);
cx->ks[v(56,(5))] = ff(ss[5]);
cx->ks[v(56,(6))] = ff(ss[6]);
cx->ks[v(56,(7))] = ff(ss[7]);
kdf8(cx->ks, 0); kd8(cx->ks, 1);
kd8(cx->ks, 2); kd8(cx->ks, 3);
kd8(cx->ks, 4); kd8(cx->ks, 5);