mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-28 05:14:29 +00:00
As a standard pattern, the vendoring script needed some changes, as did our internal code. The biggest change here is that BoringSSL has changed its name mangling scheme. This causes us to no longer need to explicitly write the prefix out anymore: in fact, doing that causes compiler errors. So this patch rewrites the code to resolve that issue. Along the way, I've also added some checks for making sure the name mangling is correct.
67 lines
1.9 KiB
C++
67 lines
1.9 KiB
C++
// Copyright 2016 The BoringSSL Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include "internal.h"
|
|
|
|
#if defined(OPENSSL_AARCH64) && defined(OPENSSL_LINUX) && \
|
|
!defined(OPENSSL_STATIC_ARMCAP) && !defined(OPENSSL_NO_ASM)
|
|
|
|
#include <sys/auxv.h>
|
|
|
|
|
|
using namespace bssl;
|
|
|
|
void bssl::OPENSSL_cpuid_setup() {
|
|
unsigned long hwcap = getauxval(AT_HWCAP);
|
|
|
|
// See /usr/include/asm/hwcap.h on an aarch64 installation for the source of
|
|
// these values.
|
|
static const unsigned long kNEON = 1 << 1;
|
|
static const unsigned long kAES = 1 << 3;
|
|
static const unsigned long kPMULL = 1 << 4;
|
|
static const unsigned long kSHA1 = 1 << 5;
|
|
static const unsigned long kSHA256 = 1 << 6;
|
|
static const unsigned long kSHA3 = 1 << 17;
|
|
static const unsigned long kSHA512 = 1 << 21;
|
|
|
|
if ((hwcap & kNEON) == 0) {
|
|
// Matching OpenSSL, if NEON is missing, don't report other features
|
|
// either.
|
|
return;
|
|
}
|
|
|
|
OPENSSL_armcap_P |= ARMV7_NEON;
|
|
|
|
if (hwcap & kAES) {
|
|
OPENSSL_armcap_P |= ARMV8_AES;
|
|
}
|
|
if (hwcap & kPMULL) {
|
|
OPENSSL_armcap_P |= ARMV8_PMULL;
|
|
}
|
|
if (hwcap & kSHA1) {
|
|
OPENSSL_armcap_P |= ARMV8_SHA1;
|
|
}
|
|
if (hwcap & kSHA256) {
|
|
OPENSSL_armcap_P |= ARMV8_SHA256;
|
|
}
|
|
if (hwcap & kSHA512) {
|
|
OPENSSL_armcap_P |= ARMV8_SHA512;
|
|
}
|
|
if (hwcap & kSHA3) {
|
|
OPENSSL_armcap_P |= ARMV8_SHA3;
|
|
}
|
|
}
|
|
|
|
#endif // OPENSSL_AARCH64 && OPENSSL_LINUX && !OPENSSL_STATIC_ARMCAP
|