Skip to content

Commit

Permalink
AES: Use SSE2-based implementation as the fallback on x86 and x86-64.
Browse files Browse the repository at this point in the history
Address some warnings from Clang/GCC in the SSE2 code that are disabled
by default in BoringSSL but not in *ring*.
  • Loading branch information
briansmith committed Oct 2, 2023
1 parent 3878b1b commit abfee0e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crypto/fipsmodule/aes/aes_nohw.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

#include "../../internal.h"

#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
#define OPENSSL_SSE2
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#endif

#if defined(OPENSSL_SSE2)
#include <emmintrin.h>
#endif
Expand Down Expand Up @@ -783,7 +790,7 @@ static const uint8_t aes_nohw_rcon[10] = {0x01, 0x02, 0x04, 0x08, 0x10,
// aes_nohw_rcon_slice returns the |i|th group of |AES_NOHW_BATCH_SIZE| bits in
// |rcon|, stored in a |aes_word_t|.
static inline aes_word_t aes_nohw_rcon_slice(uint8_t rcon, size_t i) {
rcon = (rcon >> (i * AES_NOHW_BATCH_SIZE)) & ((1 << AES_NOHW_BATCH_SIZE) - 1);
rcon = (uint8_t) ((rcon >> (i * AES_NOHW_BATCH_SIZE)) & ((1 << AES_NOHW_BATCH_SIZE) - 1));
#if defined(OPENSSL_SSE2)
return _mm_set_epi32(0, 0, 0, rcon);
#else
Expand Down

0 comments on commit abfee0e

Please sign in to comment.