Skip to content

Commit

Permalink
Update BoringSSL to aefa5d24da34ef77ac797bdbe684734e5bd870f4
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa committed Dec 13, 2024
1 parent 3ce9651 commit 6828ccf
Show file tree
Hide file tree
Showing 240 changed files with 7,464 additions and 5,568 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// Sources/CCryptoBoringSSL directory. The source repository is at
// https://boringssl.googlesource.com/boringssl.
//
// BoringSSL Commit: fcef13a49852397a0d39c00be8d7bc2ba1ab6fb9
// BoringSSL Commit: aefa5d24da34ef77ac797bdbe684734e5bd870f4

import PackageDescription

Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/asn1/posix_time.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2022, Google Inc.
/* Copyright 2022 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
30 changes: 12 additions & 18 deletions Sources/CCryptoBoringSSL/crypto/asn1/tasn_fre.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) {
}

void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
const ASN1_TEMPLATE *tt = NULL, *seqtt;
const ASN1_EXTERN_FUNCS *ef;
int i;
if (!pval) {
return;
}
Expand All @@ -97,16 +94,14 @@ void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
if (asn1_cb) {
i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
if (i == 2) {
if (asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL) == 2) {
return;
}
}
i = asn1_get_choice_selector(pval, it);
int i = asn1_get_choice_selector(pval, it);
if ((i >= 0) && (i < it->tcount)) {
ASN1_VALUE **pchval;
tt = it->templates + i;
pchval = asn1_get_field_ptr(pval, tt);
const ASN1_TEMPLATE *tt = it->templates + i;
ASN1_VALUE **pchval = asn1_get_field_ptr(pval, tt);
ASN1_template_free(pchval, tt);
}
if (asn1_cb) {
Expand All @@ -117,12 +112,14 @@ void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
break;
}

case ASN1_ITYPE_EXTERN:
ef = reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
case ASN1_ITYPE_EXTERN: {
const ASN1_EXTERN_FUNCS *ef =
reinterpret_cast<const ASN1_EXTERN_FUNCS *>(it->funcs);
if (ef && ef->asn1_ex_free) {
ef->asn1_ex_free(pval, it);
}
break;
}

case ASN1_ITYPE_SEQUENCE: {
if (!asn1_refcount_dec_and_test_zero(pval, it)) {
Expand All @@ -131,23 +128,20 @@ void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) {
const ASN1_AUX *aux = reinterpret_cast<const ASN1_AUX *>(it->funcs);
ASN1_aux_cb *asn1_cb = aux != NULL ? aux->asn1_cb : NULL;
if (asn1_cb) {
i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL);
if (i == 2) {
if (asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL) == 2) {
return;
}
}
asn1_enc_free(pval, it);
// If we free up as normal we will invalidate any ANY DEFINED BY
// field and we wont be able to determine the type of the field it
// defines. So free up in reverse order.
tt = it->templates + it->tcount - 1;
for (i = 0; i < it->tcount; tt--, i++) {
ASN1_VALUE **pseqval;
seqtt = asn1_do_adb(pval, tt, 0);
for (int i = it->tcount - 1; i >= 0; i--) {
const ASN1_TEMPLATE *seqtt = asn1_do_adb(pval, &it->templates[i], 0);
if (!seqtt) {
continue;
}
pseqval = asn1_get_field_ptr(pval, seqtt);
ASN1_VALUE **pseqval = asn1_get_field_ptr(pval, seqtt);
ASN1_template_free(pseqval, seqtt);
}
if (asn1_cb) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bcm_support.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2024, Google Inc.
/* Copyright 2024 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bio/socket_helper.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/blake2/blake2.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021, Google Inc.
/* Copyright 2021 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bn_extra/bn_asn1.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, Google Inc.
/* Copyright 2015 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/asn1_compat.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, Google Inc.
/* Copyright 2016 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/ber.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/cbb.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/cbs.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/bytestring/unicode.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, Google Inc.
/* Copyright 2018 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/chacha/chacha.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/chacha/internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, Google Inc.
/* Copyright 2018 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2017, Google Inc.
/* Copyright 2017 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2017, Google Inc.
/* Copyright 2017 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cipher_extra/e_tls.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/conf/internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2015, Google Inc.
/* Copyright 2015 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_aarch64_apple.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021, Google Inc.
/* Copyright 2021 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_aarch64_fuchsia.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, Google Inc.
/* Copyright 2018 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_aarch64_linux.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, Google Inc.
/* Copyright 2016 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_aarch64_sysreg.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023, Google Inc.
/* Copyright 2023 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_aarch64_win.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, Google Inc.
/* Copyright 2018 The BoringSSL Authors
* Copyright (c) 2020, Arm Ltd.
*
* Permission to use, copy, modify, and/or distribute this software for any
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_arm_freebsd.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2022, Google Inc.
/* Copyright 2022 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_arm_linux.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, Google Inc.
/* Copyright 2016 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_arm_linux.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2018, Google Inc.
/* Copyright 2018 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
18 changes: 17 additions & 1 deletion Sources/CCryptoBoringSSL/crypto/cpu_intel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ static uint64_t OPENSSL_xgetbv(uint32_t xcr) {
#endif
}

static bool os_supports_avx512(uint64_t xcr0) {
#if defined(__APPLE__)
// The Darwin kernel had a bug where it could corrupt the opmask registers.
// See
// https://community.intel.com/t5/Software-Tuning-Performance/MacOS-Darwin-kernel-bug-clobbers-AVX-512-opmask-register-state/m-p/1327259
// Darwin also does not initially set the XCR0 bits for AVX512, but they are
// set if the thread tries to use AVX512 anyway. Thus, to safely and
// consistently use AVX512 on macOS we'd need to check the kernel version as
// well as detect AVX512 support using a macOS-specific method. We don't
// bother with this, especially given Apple's transition to arm64.
return false;
#else
return (xcr0 & 0xe6) == 0xe6;
#endif
}

// handle_cpu_env applies the value from |in| to the CPUID values in |out[0]|
// and |out[1]|. See the comment in |OPENSSL_cpuid_setup| about this.
static void handle_cpu_env(uint32_t *out, const char *in) {
Expand Down Expand Up @@ -234,7 +250,7 @@ void OPENSSL_cpuid_setup(void) {
// See Intel manual, volume 1, sections 15.2 ("Detection of AVX-512 Foundation
// Instructions") through 15.4 ("Detection of Intel AVX-512 Instruction Groups
// Operating at 256 and 128-bit Vector Lengths").
if ((xcr0 & 0xe6) != 0xe6) {
if (!os_supports_avx512(xcr0)) {
// Without XCR0.111xx11x, no AVX512 feature can be used. This includes ZMM
// registers, masking, SIMD registers 16-31 (even if accessed as YMM or
// XMM), and EVEX-coded instructions (even on YMM or XMM). Even if only
Expand Down
4 changes: 2 additions & 2 deletions Sources/CCryptoBoringSSL/crypto/crypto.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, Google Inc.
/* Copyright 2014 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down Expand Up @@ -54,7 +54,7 @@ static_assert(sizeof(ossl_ssize_t) == sizeof(size_t),
// archive, linking on OS X will fail to resolve common symbols. By
// initialising it to zero, it becomes a "data symbol", which isn't so
// affected.
HIDDEN uint8_t BORINGSSL_function_hit[7] = {0};
HIDDEN uint8_t BORINGSSL_function_hit[8] = {0};
#endif

#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BORINGSSL_PREFIX CCryptoBoringSSL
#if defined(__arm__) && defined(__linux__)
/* Copyright (c) 2015, Google Inc.
/* Copyright 2015 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/curve25519/curve25519.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2020, Google Inc.
/* Copyright 2020 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2023, Google Inc.
/* Copyright 2023 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2020, Google Inc.
/* Copyright 2020 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/curve25519/internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2020, Google Inc.
/* Copyright 2020 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
2 changes: 1 addition & 1 deletion Sources/CCryptoBoringSSL/crypto/curve25519/spake25519.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2016, Google Inc.
/* Copyright 2016 The BoringSSL Authors
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Expand Down
4 changes: 2 additions & 2 deletions Sources/CCryptoBoringSSL/crypto/dh_extra/dh_asn1.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL
* project 2000.
/* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL project
* 2000.
*/
/* ====================================================================
* Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
Expand Down
Loading

0 comments on commit 6828ccf

Please sign in to comment.