h2o / picotls

TLS 1.3 implementation in C (master supports RFC8446 as well as draft-26, -27, -28)
540 stars 143 forks source link

Changes in memory alignment specification break fusion for windows #397

Closed huitema closed 2 years ago

huitema commented 2 years ago

The changes introduced in PR "non-temporal aes-gcm engine" #384 require 256 bit alignment, which is poorly supported in Windows.

The previous version of "fusion.h" specified:

typedef struct ptls_fusion_aesecb_context {
    __m128i keys[PTLS_FUSION_AES256_ROUNDS + 1];
    unsigned rounds;
} ptls_fusion_aesecb_context_t;

The new version has:

typedef struct ptls_fusion_aesecb_context {
    union {
        __m128i m128[PTLS_FUSION_AES256_ROUNDS + 1];
        __m256i m256[PTLS_FUSION_AES256_ROUNDS + 1];
    } keys;
    unsigned rounds;
    uint8_t aesni256;
} __attribute__((aligned(32))) ptls_fusion_aesecb_context_t;

The alignment directive __m128i is portable, but __m256i does not work so well in Windows.

I am fixing it in Picoquic by not using fusion for Windows builds.