Skip to content

Commit

Permalink
Enable Arm64 optimization on Windows (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
eukarpov committed Aug 7, 2023
1 parent 7c72985 commit 426c2cd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions crypto/arm_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
# else
# error "unsupported ARM architecture"
# endif
# else
# if defined(__ARM_ARCH)
# define __ARM_ARCH__ __ARM_ARCH
# endif
# endif
# endif

Expand Down
2 changes: 1 addition & 1 deletion crypto/modes/gcm128.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void gcm_gmult_4bit_x86(u64 Xi[2], const u128 Htable[16]);
void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp,
size_t len);
# endif
# elif defined(__arm__) || defined(__arm) || defined(__aarch64__)
# elif defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(_M_ARM64)
# include "arm_arch.h"
# if __ARM_MAX_ARCH__>=7
# define GHASH_ASM_ARM
Expand Down
2 changes: 1 addition & 1 deletion crypto/sm3/sm3_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
} while (0)

#if defined(OPENSSL_SM3_ASM)
# if defined(__aarch64__)
# if defined(__aarch64__) || defined(_M_ARM64)
# include "crypto/arm_arch.h"
# define HWSM3_CAPABLE (OPENSSL_armcap_P & ARMV8_SM3)
void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num);
Expand Down
6 changes: 3 additions & 3 deletions include/crypto/aes_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len);
# endif /* OPENSSL_SYS_AIX || OPENSSL_SYS_MACOSX */
# endif /* PPC */

# if (defined(__arm__) || defined(__arm) || defined(__aarch64__))
# if (defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(_M_ARM64))
# include "arm_arch.h"
# if __ARM_MAX_ARCH__>=7
# if defined(BSAES_ASM)
Expand All @@ -106,15 +106,15 @@ void gcm_ghash_p8(u64 Xi[2],const u128 Htable[16],const u8 *inp, size_t len);
# define HWAES_decrypt aes_v8_decrypt
# define HWAES_cbc_encrypt aes_v8_cbc_encrypt
# define HWAES_ecb_encrypt aes_v8_ecb_encrypt
# if __ARM_MAX_ARCH__>=8 && defined(__aarch64__)
# if __ARM_MAX_ARCH__>=8 && (defined(__aarch64__) || defined(_M_ARM64))
# define HWAES_xts_encrypt aes_v8_xts_encrypt
# define HWAES_xts_decrypt aes_v8_xts_decrypt
# endif
# define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks
# define AES_PMULL_CAPABLE ((OPENSSL_armcap_P & ARMV8_PMULL) && (OPENSSL_armcap_P & ARMV8_AES))
# define AES_GCM_ENC_BYTES 512
# define AES_GCM_DEC_BYTES 512
# if __ARM_MAX_ARCH__>=8 && defined(__aarch64__)
# if __ARM_MAX_ARCH__>=8 && (defined(__aarch64__) || defined(_M_ARM64))
# 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 && \
Expand Down
2 changes: 1 addition & 1 deletion include/crypto/sm4_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# pragma once

# if defined(OPENSSL_CPUID_OBJ)
# if defined(__aarch64__)
# if defined(__aarch64__) || defined (_M_ARM64)
# include "arm_arch.h"
extern unsigned int OPENSSL_arm_midr;
static inline int vpsm4_capable(void)
Expand Down

0 comments on commit 426c2cd

Please sign in to comment.