未验证 提交 d9926b42 编写于 作者: O openharmony_ci 提交者: Gitee

!60 modify the config file to adapt x86_64

Merge pull request !60 from zhao_zhen_zhou/master
......@@ -76,6 +76,26 @@ config("crypto_config") {
"-DECP_NISTZ256_ASM",
"-DPOLY1305_ASM",
]
} else if (current_cpu == "x86_64" && current_os != "mingw") {
cflags += [
"-DOPENSSL_CPUID_OBJ",
"-DOPENSSL_BN_ASM_MONT",
"-DSHA1_ASM",
"-DSHA256_ASM",
"-DSHA512_ASM",
"-DKECCAK1600_ASM",
"-DVPAES_ASM",
"-DECP_NISTZ256_ASM",
"-DPOLY1305_ASM",
"-DOPENSSL_IA32_SSE2",
"-DOPENSSL_BN_ASM_MONT5",
"-DOPENSSL_BN_ASM_GF2m",
"-DRC4_ASM",
"-DMD5_ASM",
"-DAESNI_ASM",
"-DGHASH_ASM",
"-DX25519_ASM",
]
} else if (is_mingw) {
cflags -= [
"-fPIC",
......@@ -133,6 +153,8 @@ config("crypto_config_public") {
} else if (current_cpu == "arm64" &&
!(current_os == "linux" || host_os == "mac")) {
cflags = [ "-DOPENSSL_ARM64_PLATFORM" ]
} else if (current_cpu == "x86_64" && current_os != "mingw") {
cflags = [ "-DOPENSSL_X86_64_PLATFORM" ]
} else if (is_mingw) {
cflags = [ "-DWINDOWS_PLATFORM" ]
} else if (current_os == "linux" || host_os == "mac") {
......@@ -784,6 +806,44 @@ ohos_source_set("crypto_source") {
"crypto/sha/sha256-armv8.S",
"crypto/sha/sha512-armv8.S",
]
} else if (current_cpu == "x86_64" && current_os != "mingw") {
sources -= [
"crypto/rc4/rc4_enc.c",
"crypto/rc4/rc4_skey.c",
"crypto/whrlpool/wp_block.c",
]
sources += [
"crypto/aes/aes_core.c",
"crypto/aes/asm/x86_64/aesni-mb-x86_64.s",
"crypto/aes/asm/x86_64/aesni-sha1-x86_64.s",
"crypto/aes/asm/x86_64/aesni-sha256-x86_64.s",
"crypto/aes/asm/x86_64/aesni-x86_64.s",
"crypto/aes/asm/x86_64/vpaes-x86_64.s",
"crypto/bn/asm/x86_64/rsaz-avx2.s",
"crypto/bn/asm/x86_64/rsaz-x86_64.s",
"crypto/bn/asm/x86_64/x86_64-gf2m.s",
"crypto/bn/asm/x86_64/x86_64-mont.s",
"crypto/bn/asm/x86_64/x86_64-mont5.s",
"crypto/bn/rsaz_exp.c",
"crypto/chacha/asm/x86_64/chacha-x86_64.s",
"crypto/ec/asm/x86_64/ecp_nistz256-x86_64.s",
"crypto/ec/asm/x86_64/x25519-x86_64.s",
"crypto/ec/ecp_nistz256.c",
"crypto/md5/asm/x86_64/md5-x86_64.s",
"crypto/modes/asm/x86_64/aesni-gcm-x86_64.s",
"crypto/modes/asm/x86_64/ghash-x86_64.s",
"crypto/poly1305/asm/x86_64/poly1305-x86_64.s",
"crypto/rc4/asm/x86_64/rc4-md5-x86_64.s",
"crypto/rc4/asm/x86_64/rc4-x86_64.s",
"crypto/sha/asm/x86_64/keccak1600-x86_64.s",
"crypto/sha/asm/x86_64/sha1-mb-x86_64.s",
"crypto/sha/asm/x86_64/sha1-x86_64.s",
"crypto/sha/asm/x86_64/sha256-mb-x86_64.s",
"crypto/sha/asm/x86_64/sha256-x86_64.s",
"crypto/sha/asm/x86_64/sha512-x86_64.s",
"crypto/whrlpool/asm/x86_64/wp-x86_64.s",
"crypto/x86_64cpuid.s",
]
} else if (is_mingw || (current_os == "linux" || host_os == "mac")) {
sources += [
"crypto/aes/aes_core.c",
......@@ -908,6 +968,8 @@ config("ssl_config") {
} else if (current_cpu == "arm64" &&
!(current_os == "linux" || host_os == "mac")) {
cflags += [ "-DOPENSSL_ARM64_PLATFORM" ]
} else if (current_cpu == "x86_64" && current_os != "mingw") {
cflags += [ "-DOPENSSL_X86_64_PLATFORM" ]
} else if (is_mingw) {
cflags -= [ "-fPIC" ]
cflags += [
......
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved.
* Description: This README describes how to generate the .S files.
* Create: 2020-05-30
*/
......@@ -32,4 +32,31 @@
"crypto/sha/sha1-armv8.S",
"crypto/sha/sha256-armv8.S",
"crypto/sha/sha512-armv8.S",
"crypto/aes/asm/x86_64/aesni-mb-x86_64.s",
"crypto/aes/asm/x86_64/aesni-sha1-x86_64.s",
"crypto/aes/asm/x86_64/aesni-sha256-x86_64.s",
"crypto/aes/asm/x86_64/aesni-x86_64.s",
"crypto/aes/asm/x86_64/vpaes-x86_64.s",
"crypto/bn/asm/x86_64/rsaz-avx2.s",
"crypto/bn/asm/x86_64/rsaz-x86_64.s",
"crypto/bn/asm/x86_64/x86_64-gf2m.s",
"crypto/bn/asm/x86_64/x86_64-mont.s",
"crypto/bn/asm/x86_64/x86_64-mont5.s",
"crypto/chacha/asm/x86_64/chacha-x86_64.s",
"crypto/ec/asm/x86_64/ecp_nistz256-x86_64.s",
"crypto/ec/asm/x86_64/x25519-x86_64.s",
"crypto/md5/asm/x86_64/md5-x86_64.s",
"crypto/modes/asm/x86_64/aesni-gcm-x86_64.s",
"crypto/modes/asm/x86_64/ghash-x86_64.s",
"crypto/poly1305/asm/x86_64/poly1305-x86_64.s",
"crypto/rc4/asm/x86_64/rc4-md5-x86_64.s",
"crypto/rc4/asm/x86_64/rc4-x86_64.s",
"crypto/sha/asm/x86_64/keccak1600-x86_64.s",
"crypto/sha/asm/x86_64/sha1-mb-x86_64.s",
"crypto/sha/asm/x86_64/sha1-x86_64.s",
"crypto/sha/asm/x86_64/sha256-mb-x86_64.s",
"crypto/sha/asm/x86_64/sha256-x86_64.s",
"crypto/sha/asm/x86_64/sha512-x86_64.s",
"crypto/whrlpool/asm/x86_64/wp-x86_64.s",
"crypto/x86_64cpuid.s",
are generated by perl executing .pl files. you can also execute the script of create_asm_file.sh to generate it.
\ No newline at end of file
#!/bin/bash
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved.
# Description: This script is used to generate .S files.
# Create: 2020-05-30
......@@ -59,6 +59,59 @@ perl crypto/sha/asm/keccak1600-armv8.pl linux64 crypto/sha/keccak1600-armv8.S
perl crypto/sha/asm/sha1-armv8.pl linux64 crypto/sha/sha1-armv8.S
perl crypto/sha/asm/sha512-armv8.pl linux64 crypto/sha/sha256-armv8.S
perl crypto/sha/asm/sha512-armv8.pl linux64 crypto/sha/sha512-armv8.S
#need x86_64-linux-android-clang cross compile chain in your environment path,
#otherwise the generated asm files cannot be used
x86_64-linux-android-clang -v
rm -rf crypto/aes/asm/x86_64
rm -rf crypto/bn/asm/x86_64
rm -rf crypto/chacha/asm/x86_64
rm -rf crypto/ec/asm/x86_64
rm -rf crypto/md5/asm/x86_64
rm -rf crypto/modes/asm/x86_64
rm -rf crypto/poly1305/asm/x86_64
rm -rf crypto/rc4/asm/x86_64
rm -rf crypto/sha/asm/x86_64
rm -rf crypto/whrlpool/asm/x86_64
rm -rf crypto/x86_64cpuid.s
mkdir crypto/aes/asm/x86_64
mkdir crypto/bn/asm/x86_64
mkdir crypto/chacha/asm/x86_64
mkdir crypto/ec/asm/x86_64
mkdir crypto/md5/asm/x86_64
mkdir crypto/modes/asm/x86_64
mkdir crypto/poly1305/asm/x86_64
mkdir crypto/rc4/asm/x86_64
mkdir crypto/sha/asm/x86_64
mkdir crypto/whrlpool/asm/x86_64
# for x86_64:
CC="x86_64-linux-android-clang" perl crypto/aes/asm/aesni-mb-x86_64.pl elf crypto/aes/asm/x86_64/aesni-mb-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/aes/asm/aesni-sha1-x86_64.pl elf crypto/aes/asm/x86_64/aesni-sha1-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/aes/asm/aesni-sha256-x86_64.pl elf crypto/aes/asm/x86_64/aesni-sha256-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/aes/asm/aesni-x86_64.pl elf crypto/aes/asm/x86_64/aesni-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/aes/asm/vpaes-x86_64.pl elf crypto/aes/asm/x86_64/vpaes-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/bn/asm/rsaz-avx2.pl elf crypto/bn/asm/x86_64/rsaz-avx2.s
CC="x86_64-linux-android-clang" perl crypto/bn/asm/rsaz-x86_64.pl elf crypto/bn/asm/x86_64/rsaz-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/bn/asm/x86_64-gf2m.pl elf crypto/bn/asm/x86_64/x86_64-gf2m.s
CC="x86_64-linux-android-clang" perl crypto/bn/asm/x86_64-mont.pl elf crypto/bn/asm/x86_64/x86_64-mont.s
CC="x86_64-linux-android-clang" perl crypto/bn/asm/x86_64-mont5.pl elf crypto/bn/asm/x86_64/x86_64-mont5.s
CC="x86_64-linux-android-clang" perl crypto/chacha/asm/chacha-x86_64.pl elf crypto/chacha/asm/x86_64/chacha-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/ec/asm/ecp_nistz256-x86_64.pl elf crypto/ec/asm/x86_64/ecp_nistz256-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/ec/asm/x25519-x86_64.pl elf crypto/ec/asm/x86_64/x25519-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/md5/asm/md5-x86_64.pl elf crypto/md5/asm/x86_64/md5-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/modes/asm/aesni-gcm-x86_64.pl elf crypto/modes/asm/x86_64/aesni-gcm-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/modes/asm/ghash-x86_64.pl elf crypto/modes/asm/x86_64/ghash-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/poly1305/asm/poly1305-x86_64.pl elf crypto/poly1305/asm/x86_64/poly1305-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/rc4/asm/rc4-md5-x86_64.pl elf crypto/rc4/asm/x86_64/rc4-md5-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/rc4/asm/rc4-x86_64.pl elf crypto/rc4/asm/x86_64/rc4-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/keccak1600-x86_64.pl elf crypto/sha/asm/x86_64/keccak1600-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/sha1-mb-x86_64.pl elf crypto/sha/asm/x86_64/sha1-mb-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/sha1-x86_64.pl elf crypto/sha/asm/x86_64/sha1-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/sha256-mb-x86_64.pl elf crypto/sha/asm/x86_64/sha256-mb-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/sha512-x86_64.pl elf crypto/sha/asm/x86_64/sha256-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/sha/asm/sha512-x86_64.pl elf crypto/sha/asm/x86_64/sha512-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/whrlpool/asm/wp-x86_64.pl elf crypto/whrlpool/asm/x86_64/wp-x86_64.s
CC="x86_64-linux-android-clang" perl crypto/x86_64cpuid.pl elf crypto/x86_64cpuid.s
if [ $? -ne 0 ]; then
error
else
......
......@@ -120,4 +120,50 @@ static const char compiler_flags[] = {
'I','C',' ','-','D','_','R','E','E','N','T','R','A','N','T',' ',
'-','D','N','D','E','B','U','G','\0'
};
#endif // MAC_PLATFORM
\ No newline at end of file
#endif // MAC_PLATFORM
#ifdef OPENSSL_X86_64_PLATFORM
#define PLATFORM "platform: android-x86_64"
#define DATE "built on: Mon Jun 20 03:40:52 2022 UTC"
/*
* Generate compiler_flags as an array of individual characters. This is a
* workaround for the situation where CFLAGS gets too long for a C90 string
* literal
*/
static const char compiler_flags[] = {
'c','o','m','p','i','l','e','r',':',' ','x','8','6','_','6','4',
'-','l','i','n','u','x','-','a','n','d','r','o','i','d','-','c',
'l','a','n','g',' ','-','f','P','I','C',' ','-','p','t','h','r',
'e','a','d',' ',' ','-','-','s','y','s','r','o','o','t','=','/',
'h','o','m','e','/','z','h','a','o','z','h','e','n','z','h','o',
'u','/','w','o','r','k','s','p','a','c','e','/','t','h','i','r',
'd','_','p','a','r','t','y','_','o','p','e','n','s','s','l','/',
'o','p','e','n','s','s','l','_','f','r','o','m','_','o','f','f',
'i','c','a','l','/','n','d','k','/','n','d','k','_','t','o','o',
'l','_','r','2','1','e','/','n','d','k','_','m','a','c','/','s',
'y','s','r','o','o','t',' ','-','W','a',',','-','-','n','o','e',
'x','e','c','s','t','a','c','k',' ','-','Q','u','n','u','s','e',
'd','-','a','r','g','u','m','e','n','t','s',' ','-','W','a','l',
'l',' ','-','O','3',' ','-','D','O','P','E','N','S','S','L','_',
'U','S','E','_','N','O','D','E','L','E','T','E',' ','-','D','O',
'P','E','N','S','S','L','_','P','I','C',' ','-','D','O','P','E',
'N','S','S','L','_','C','P','U','I','D','_','O','B','J',' ','-',
'D','O','P','E','N','S','S','L','_','I','A','3','2','_','S','S',
'E','2',' ','-','D','O','P','E','N','S','S','L','_','B','N','_',
'A','S','M','_','M','O','N','T',' ','-','D','O','P','E','N','S',
'S','L','_','B','N','_','A','S','M','_','M','O','N','T','5',' ',
'-','D','O','P','E','N','S','S','L','_','B','N','_','A','S','M',
'_','G','F','2','m',' ','-','D','S','H','A','1','_','A','S','M',
' ','-','D','S','H','A','2','5','6','_','A','S','M',' ','-','D',
'S','H','A','5','1','2','_','A','S','M',' ','-','D','K','E','C',
'C','A','K','1','6','0','0','_','A','S','M',' ','-','D','R','C',
'4','_','A','S','M',' ','-','D','M','D','5','_','A','S','M',' ',
'-','D','A','E','S','N','I','_','A','S','M',' ','-','D','V','P',
'A','E','S','_','A','S','M',' ','-','D','G','H','A','S','H','_',
'A','S','M',' ','-','D','E','C','P','_','N','I','S','T','Z','2',
'5','6','_','A','S','M',' ','-','D','X','2','5','5','1','9','_',
'A','S','M',' ','-','D','P','O','L','Y','1','3','0','5','_','A',
'S','M',' ','-','D','N','D','E','B','U','G','\0'
};
#endif // OPENSSL_X86_64_PLATFORM
\ No newline at end of file
......@@ -9,7 +9,7 @@
* https://www.openssl.org/source/license.html
*/
#ifdef OPENSSL_ARM64_PLATFORM
#if defined(OPENSSL_ARM64_PLATFORM) || defined(OPENSSL_X86_64_PLATFORM)
#ifndef OSSL_CRYPTO_BN_CONF_H
# define OSSL_CRYPTO_BN_CONF_H
......@@ -27,7 +27,7 @@
#undef THIRTY_TWO_BIT
#endif
#endif // OPENSSL_ARM64_PLATFORM
#endif // OPENSSL_ARM64_PLATFORM || OPENSSL_X86_64_PLATFORM
#ifdef OPENSSL_ARM_PLATFORM
#ifndef OSSL_CRYPTO_BN_CONF_H
......
......@@ -9,14 +9,14 @@
* https://www.openssl.org/source/license.html
*/
#ifdef OPENSSL_ARM64_PLATFORM
#if defined(OPENSSL_ARM64_PLATFORM) || defined(OPENSSL_X86_64_PLATFORM)
#ifndef OSSL_CRYPTO_DSO_CONF_H
# define OSSL_CRYPTO_DSO_CONF_H
# define DSO_DLFCN
# define HAVE_DLFCN_H
# define DSO_EXTENSION ".so"
#endif
#endif // OPENSSL_ARM64_PLATFORM
#endif // OPENSSL_ARM64_PLATFORM || OPENSSL_X86_64_PLATFORM
#ifdef OPENSSL_ARM_PLATFORM
#ifndef OSSL_CRYPTO_DSO_CONF_H
......
......@@ -10,7 +10,7 @@
* https://www.openssl.org/source/license.html
*/
#ifdef OPENSSL_ARM64_PLATFORM
#if defined(OPENSSL_ARM64_PLATFORM) || defined(OPENSSL_X86_64_PLATFORM)
#include <openssl/opensslv.h>
#ifdef __cplusplus
......@@ -212,12 +212,16 @@ extern "C" {
# undef THIRTY_TWO_BIT
#endif
#ifdef OPENSSL_ARM64_PLATFORM
#define RC4_INT unsigned char
#else
#define RC4_INT unsigned int
#endif
#ifdef __cplusplus
}
#endif
#endif // OPENSSL_ARM64_PLATFORM
#endif // OPENSSL_ARM64_PLATFORM || OPENSSL_X86_64_PLATFORM
#ifdef OPENSSL_ARM_PLATFORM
#include <openssl/opensslv.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册