diff options
author | Todd Short <tshort@akamai.com> | 2022-07-20 10:54:24 -0400 |
---|---|---|
committer | Todd Short <todd.short@me.com> | 2022-07-22 08:34:13 -0400 |
commit | 92c9086e5c2b63606cd28a7f13f09b9ff35a0de3 (patch) | |
tree | 7b0bc018fc4c7e1fc9fbfe315e3e7c6304eda4b5 /include/crypto | |
parent | 7da952bcc54604141ea8ed40ec5ed1fd2f74cc25 (diff) | |
download | openssl-92c9086e5c2b63606cd28a7f13f09b9ff35a0de3.tar.gz |
Use separate function to get GCM functions
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18835)
Diffstat (limited to 'include/crypto')
-rw-r--r-- | include/crypto/aes_platform.h | 6 | ||||
-rw-r--r-- | include/crypto/modes.h | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/include/crypto/aes_platform.h b/include/crypto/aes_platform.h index 4967d59a64..836f7dca2d 100644 --- a/include/crypto/aes_platform.h +++ b/include/crypto/aes_platform.h @@ -92,7 +92,7 @@ size_t ppc_aes_gcm_decrypt_wrap(const unsigned char *in, unsigned char *out, # define AES_gcm_encrypt ppc_aes_gcm_encrypt_wrap # define AES_gcm_decrypt ppc_aes_gcm_decrypt_wrap # define AES_GCM_ASM(gctx) ((gctx)->ctr==aes_p8_ctr32_encrypt_blocks && \ - (gctx)->gcm.ghash==gcm_ghash_p8) + (gctx)->gcm.funcs.ghash==gcm_ghash_p8) void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); # endif /* PPC */ @@ -124,7 +124,7 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len); # define AES_gcm_encrypt armv8_aes_gcm_encrypt # define AES_gcm_decrypt armv8_aes_gcm_decrypt # define AES_GCM_ASM(gctx) ((gctx)->ctr==aes_v8_ctr32_encrypt_blocks && \ - (gctx)->gcm.ghash==gcm_ghash_v8) + (gctx)->gcm.funcs.ghash==gcm_ghash_v8) size_t aes_gcm_enc_128_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, uint64_t *Xi, unsigned char ivec[16], const void *key); size_t aes_gcm_enc_192_kernel(const uint8_t * plaintext, uint64_t plaintext_length, uint8_t * ciphertext, @@ -258,7 +258,7 @@ void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len); # define AES_gcm_encrypt aesni_gcm_encrypt # define AES_gcm_decrypt aesni_gcm_decrypt # define AES_GCM_ASM(ctx) (ctx->ctr == aesni_ctr32_encrypt_blocks && \ - ctx->gcm.ghash == gcm_ghash_avx) + ctx->gcm.funcs.ghash == gcm_ghash_avx) # endif diff --git a/include/crypto/modes.h b/include/crypto/modes.h index ad45e56d71..573e1197d0 100644 --- a/include/crypto/modes.h +++ b/include/crypto/modes.h @@ -107,6 +107,15 @@ _asm mov eax, val _asm bswap eax} u64 hi, lo; } u128; +typedef void (*gcm_init_fn)(u128 Htable[16], const u64 H[2]); +typedef void (*gcm_ghash_fn)(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len); +typedef void (*gcm_gmult_fn)(u64 Xi[2], const u128 Htable[16]); +struct gcm_funcs_st { + gcm_init_fn ginit; + gcm_ghash_fn ghash; + gcm_gmult_fn gmult; +}; + struct gcm128_context { /* Following 6 names follow names in GCM specification */ union { @@ -120,9 +129,7 @@ struct gcm128_context { * used in some assembler modules, i.e. don't change the order! */ u128 Htable[16]; - void (*gmult) (u64 Xi[2], const u128 Htable[16]); - void (*ghash) (u64 Xi[2], const u128 Htable[16], const u8 *inp, - size_t len); + struct gcm_funcs_st funcs; unsigned int mres, ares; block128_f block; void *key; |