diff --git a/src/crypto/cipher_extra/e_chacha20poly1305.c b/src/crypto/cipher_extra/e_chacha20poly1305.c index 6510ff48a..3ac2af82f 100644 --- a/src/crypto/cipher_extra/e_chacha20poly1305.c +++ b/src/crypto/cipher_extra/e_chacha20poly1305.c @@ -41,6 +41,13 @@ static_assert(alignof(union evp_aead_ctx_st_state) >= static int aead_chacha20_poly1305_init(EVP_AEAD_CTX *ctx, const uint8_t *key, size_t key_len, size_t tag_len) { + // TODO(crbug.com/42290548): The x86_64 assembly depends on initializing + // |OPENSSL_ia32cap_P|. Move the dispatch to C. While we're here, it may be + // worth adjusting the assembly calling convention. The assembly functions do + // too much work right now. For now, explicitly initialize |OPENSSL_ia32cap_P| + // first. + CRYPTO_library_init(); + struct aead_chacha20_poly1305_ctx *c20_ctx = (struct aead_chacha20_poly1305_ctx *)&ctx->state; diff --git a/src/crypto/fipsmodule/ec/p256-nistz.c b/src/crypto/fipsmodule/ec/p256-nistz.c index cf0996382..277382046 100644 --- a/src/crypto/fipsmodule/ec/p256-nistz.c +++ b/src/crypto/fipsmodule/ec/p256-nistz.c @@ -612,6 +612,11 @@ static int ecp_nistz256_cmp_x_coordinate(const EC_GROUP *group, } DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistz256_method) { + // TODO(crbug.com/42290548): The x86_64 assembly depends on initializing + // |OPENSSL_ia32cap_P|. Move the dispatch to C. For now, explicitly initialize + // things. + CRYPTO_library_init(); + out->point_get_affine_coordinates = ecp_nistz256_get_affine; out->add = ecp_nistz256_add; out->dbl = ecp_nistz256_dbl;