blob: 853b4a0feec431dae384256ba5072f83577d9d99 [file] [log] [blame]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
library("uboringssl") {
kernel = true
host = true
static = true
sources = [
"crypto/fipsmodule/sha/sha256.c",
]
if (is_kernel) {
sources += [ "crypto/chacha/chacha.c" ]
# Avoid circularity.
configs -= [ "$zx/kernel/vm:headers.config" ]
defines = [
# The assembly code uses vector registers, which is not allowed in
# kernel code.
"OPENSSL_NO_ASM",
"OPENSSL_NO_THREADS_CORRUPT_MEMORY_AND_LEAK_SECRETS_IF_THREADED",
]
} else {
configs += [ "$zx/public/gn/config:visibility_hidden" ]
if (is_fuchsia) {
deps = [
"$zx/system/ulib/fdio",
"$zx/system/ulib/zircon",
]
} else {
defines = [
# Required for `pthread_rwlock_t`.
"_XOPEN_SOURCE=700",
]
}
sources += [
"crypto/cipher_extra/e_aesgcmsiv.c",
"crypto/cpu-aarch64-fuchsia.c",
"crypto/cpu-arm.c",
"crypto/cpu-intel.c",
"crypto/crypto.c",
"crypto/err/err.c",
"crypto/fipsmodule/aes/aes.c",
"crypto/fipsmodule/aes/mode_wrappers.c",
"crypto/fipsmodule/cipher/aead.c",
"crypto/fipsmodule/cipher/cipher.c",
"crypto/fipsmodule/cipher/e_aes.c",
"crypto/fipsmodule/digest/digest.c",
"crypto/fipsmodule/digest/digests.c",
"crypto/fipsmodule/hmac/hmac.c",
"crypto/fipsmodule/modes/gcm.c",
"crypto/fipsmodule/modes/polyval.c",
"crypto/hkdf/hkdf.c",
"crypto/mem.c",
"crypto/thread_pthread.c",
"zircon-unused.c",
# TODO(aarongreen): Replace or get upstream to support more fully.
"decrepit/xts/xts.c",
# Auto-generated sources.
"err_data.c",
]
if (current_cpu == "arm64") {
sources += [
"linux-aarch64/crypto/fipsmodule/aesv8-armx64.S",
"linux-aarch64/crypto/fipsmodule/ghashv8-armx64.S",
"linux-aarch64/crypto/fipsmodule/sha256-armv8.S",
]
} else if (current_cpu == "x64") {
if (current_os == "mac") {
asm_dir = "mac-x86_64/crypto"
} else {
asm_dir = "linux-x86_64/crypto"
}
sources += [
"$asm_dir/cipher_extra/aes128gcmsiv-x86_64.S",
"$asm_dir/fipsmodule/aes-x86_64.S",
"$asm_dir/fipsmodule/aesni-gcm-x86_64.S",
"$asm_dir/fipsmodule/aesni-x86_64.S",
"$asm_dir/fipsmodule/bsaes-x86_64.S",
"$asm_dir/fipsmodule/ghash-x86_64.S",
"$asm_dir/fipsmodule/sha256-x86_64.S",
"$asm_dir/fipsmodule/vpaes-x86_64.S",
]
}
}
}