aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules2
-rw-r--r--Makefile8
m---------src/deps/boringssl0
-rw-r--r--src/deps/boringssl.translated.zig19
-rw-r--r--src/deps/patches/boringssl/.patches6
-rw-r--r--src/deps/patches/boringssl/expose_aes-cfb.patch71
-rw-r--r--src/deps/patches/boringssl/expose_blowfish_ciphers.patch47
-rw-r--r--src/deps/patches/boringssl/expose_des-ede3.patch39
-rw-r--r--src/deps/patches/boringssl/expose_ripemd160.patch97
-rw-r--r--src/deps/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch88
10 files changed, 372 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules
index 8012e5461..624cf9c0a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -36,7 +36,7 @@ shallow = true
fetchRecurseSubmodules = false
[submodule "src/deps/boringssl"]
path = src/deps/boringssl
-url = https://github.com/google/boringssl.git
+url = https://github.com/oven-sh/boringssl.git
ignore = dirty
depth = 1
shallow = true
diff --git a/Makefile b/Makefile
index 7c8d38382..5c9d59ce1 100644
--- a/Makefile
+++ b/Makefile
@@ -418,6 +418,7 @@ MINIMUM_ARCHIVE_FILES = -L$(BUN_DEPS_OUT_DIR) \
$(_MIMALLOC_LINK) \
-lssl \
-lcrypto \
+ -ldecrepit \
-llolhtml
ARCHIVE_FILES_WITHOUT_LIBCRYPTO = $(MINIMUM_ARCHIVE_FILES) \
@@ -565,7 +566,7 @@ lolhtml:
# no asm is not worth it!!
.PHONY: boringssl-build
boringssl-build:
- cd $(BUN_DEPS_DIR)/boringssl && mkdir -p build && cd build && CFLAGS="$(CFLAGS)" cmake $(CMAKE_FLAGS) -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -GNinja .. && ninja
+ cd $(BUN_DEPS_DIR)/boringssl && mkdir -p build && cd build && CFLAGS="$(CFLAGS)" cmake $(CMAKE_FLAGS) -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" -GNinja .. && ninja libcrypto.a libssl.a libdecrepit.a
.PHONY: boringssl-build-debug
boringssl-build-debug:
@@ -574,6 +575,7 @@ boringssl-build-debug:
boringssl-copy:
cp $(BUN_DEPS_DIR)/boringssl/build/ssl/libssl.a $(BUN_DEPS_OUT_DIR)/libssl.a
cp $(BUN_DEPS_DIR)/boringssl/build/crypto/libcrypto.a $(BUN_DEPS_OUT_DIR)/libcrypto.a
+ cp $(BUN_DEPS_DIR)/boringssl/build/decrepit/libdecrepit.a $(BUN_DEPS_OUT_DIR)/libdecrepit.a
.PHONY: boringssl
boringssl: boringssl-build boringssl-copy
@@ -1422,7 +1424,7 @@ bun-link-lld-debug:
$(DEBUG_BIN)/bun-debug.o \
-W \
-o $(DEBUG_BIN)/bun-debug
- rm -f $(DEBUG_BIN)/bun-debug.o.o 2> /dev/null # workaround for https://github.com/ziglang/zig/issues/14080
+ @rm -f $(DEBUG_BIN)/bun-debug.o.o 2> /dev/null # workaround for https://github.com/ziglang/zig/issues/14080
bun-link-lld-debug-no-jsc:
$(CXX) $(BUN_LLD_FLAGS_WITHOUT_JSC) $(SYMBOLS) \
@@ -1451,7 +1453,7 @@ bun-link-lld-release:
$(OPTIMIZATION_LEVEL) $(RELEASE_FLAGS)
rm -rf $(BUN_RELEASE_BIN).dSYM
cp $(BUN_RELEASE_BIN) $(BUN_RELEASE_BIN)-profile
- rm -f $(BUN_RELEASE_BIN).o.o # workaround for https://github.com/ziglang/zig/issues/14080
+ @rm -f $(BUN_RELEASE_BIN).o.o # workaround for https://github.com/ziglang/zig/issues/14080
bun-release-copy-obj:
cp $(BUN_RELEASE_BIN).o $(BUN_DEPLOY_DIR).o
diff --git a/src/deps/boringssl b/src/deps/boringssl
-Subproject 04989786e9ab16cef5261bbd05a2b1a8cb312db
+Subproject b275c5ce1c88bc06f5a967026d3c0ce1df2be81
diff --git a/src/deps/boringssl.translated.zig b/src/deps/boringssl.translated.zig
index e0e7408bc..a26a64154 100644
--- a/src/deps/boringssl.translated.zig
+++ b/src/deps/boringssl.translated.zig
@@ -134,8 +134,24 @@ pub const struct_Netscape_spki_st = extern struct {
signature: [*c]ASN1_BIT_STRING,
};
pub const NETSCAPE_SPKI = struct_Netscape_spki_st;
-pub const struct_RIPEMD160state_st = opaque {};
+
+pub const struct_RIPEMD160state_st = extern struct {
+ h: [5]u32,
+ Nl: u32,
+ Nh: u32,
+ data: [64]u8,
+ num: c_uint,
+};
pub const RIPEMD160_CTX = struct_RIPEMD160state_st;
+pub const RIPEMD160_CBLOCK = @as(c_int, 64);
+pub const RIPEMD160_LBLOCK = @import("std").zig.c_translation.MacroArithmetic.div(RIPEMD160_CBLOCK, @as(c_int, 4));
+pub const RIPEMD160_DIGEST_LENGTH = @as(c_int, 20);
+pub extern fn RIPEMD160_Init(ctx: [*c]RIPEMD160_CTX) c_int;
+pub extern fn RIPEMD160_Update(ctx: [*c]RIPEMD160_CTX, data: ?*const anyopaque, len: usize) c_int;
+pub extern fn RIPEMD160_Final(out: [*c]u8, ctx: [*c]RIPEMD160_CTX) c_int;
+pub extern fn RIPEMD160(data: [*c]const u8, len: usize, out: [*c]u8) [*c]u8;
+pub extern fn RIPEMD160_Transform(ctx: [*c]RIPEMD160_CTX, block: [*c]const u8) void;
+
pub const struct_X509_POLICY_CACHE_st = opaque {};
pub const X509_POLICY_CACHE = struct_X509_POLICY_CACHE_st;
pub const struct_X509_POLICY_LEVEL_st = opaque {};
@@ -2806,6 +2822,7 @@ pub extern fn X509_ALGOR_new() [*c]X509_ALGOR;
pub extern fn X509_ALGOR_free(a: [*c]X509_ALGOR) void;
pub extern fn d2i_X509_ALGOR(a: [*c][*c]X509_ALGOR, in: [*c][*c]const u8, len: c_long) [*c]X509_ALGOR;
pub extern fn i2d_X509_ALGOR(a: [*c]X509_ALGOR, out: [*c][*c]u8) c_int;
+
pub extern const X509_ALGOR_it: ASN1_ITEM;
pub const struct_stack_st_X509_ALGOR = opaque {};
pub const stack_X509_ALGOR_free_func = ?*const fn ([*c]X509_ALGOR) callconv(.C) void;
diff --git a/src/deps/patches/boringssl/.patches b/src/deps/patches/boringssl/.patches
new file mode 100644
index 000000000..1bea01e3e
--- /dev/null
+++ b/src/deps/patches/boringssl/.patches
@@ -0,0 +1,6 @@
+expose_ripemd160.patch
+expose_aes-cfb.patch
+expose_des-ede3.patch
+fix_sync_evp_get_cipherbynid_and_evp_get_cipherbyname.patch
+expose_blowfish_ciphers.patch
+revert_track_ssl_error_zero_return_explicitly.patch
diff --git a/src/deps/patches/boringssl/expose_aes-cfb.patch b/src/deps/patches/boringssl/expose_aes-cfb.patch
new file mode 100644
index 000000000..1f096efb6
--- /dev/null
+++ b/src/deps/patches/boringssl/expose_aes-cfb.patch
@@ -0,0 +1,71 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Apthorp <nornagon@nornagon.net>
+Date: Fri, 18 Jan 2019 14:23:28 -0800
+Subject: expose aes-{128,256}-cfb
+
+This exposes AES-CFB ciphers through the EVP APIs. BoringSSL has
+implementations for these ciphers, but Node doesn't realise that because
+without this patch, they're not listed in the APIs that Node uses.
+
+This should be upstreamed. See e.g.
+https://boringssl-review.googlesource.com/c/boringssl/+/33984 for a
+similar patch that was merged upstream.
+
+diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
+index 62850ab6a216d401d023f81007fb59a33b4585f3..0c30b0329d32b94b22f342f95035e927797d0aaf 100644
+--- a/crypto/cipher_extra/cipher_extra.c
++++ b/crypto/cipher_extra/cipher_extra.c
+@@ -73,6 +73,7 @@ static const struct {
+ const EVP_CIPHER *(*func)(void);
+ } kCiphers[] = {
+ {NID_aes_128_cbc, "aes-128-cbc", EVP_aes_128_cbc},
++ {NID_aes_128_cfb128, "aes-128-cfb", EVP_aes_128_cfb128},
+ {NID_aes_128_ctr, "aes-128-ctr", EVP_aes_128_ctr},
+ {NID_aes_128_ecb, "aes-128-ecb", EVP_aes_128_ecb},
+ {NID_aes_128_gcm, "aes-128-gcm", EVP_aes_128_gcm},
+@@ -83,6 +84,7 @@ static const struct {
+ {NID_aes_192_gcm, "aes-192-gcm", EVP_aes_192_gcm},
+ {NID_aes_192_ofb128, "aes-192-ofb", EVP_aes_192_ofb},
+ {NID_aes_256_cbc, "aes-256-cbc", EVP_aes_256_cbc},
++ {NID_aes_256_cfb128, "aes-256-cfb", EVP_aes_256_cfb128},
+ {NID_aes_256_ctr, "aes-256-ctr", EVP_aes_256_ctr},
+ {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
+ {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
+diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
+index 852b76bea69988e0b3ac76a17b603128f239dde0..d443f4dc2daea0b7aa86ae75d31d995fae667ba9 100644
+--- a/decrepit/evp/evp_do_all.c
++++ b/decrepit/evp/evp_do_all.c
+@@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ const char *unused, void *arg),
+ void *arg) {
+ callback(EVP_aes_128_cbc(), "AES-128-CBC", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "AES-128-CFB", NULL, arg);
+ callback(EVP_aes_192_cbc(), "AES-192-CBC", NULL, arg);
+ callback(EVP_aes_256_cbc(), "AES-256-CBC", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "AES-256-CFB", NULL, arg);
+ callback(EVP_aes_128_ctr(), "AES-128-CTR", NULL, arg);
+ callback(EVP_aes_192_ctr(), "AES-192-CTR", NULL, arg);
+ callback(EVP_aes_256_ctr(), "AES-256-CTR", NULL, arg);
+@@ -44,8 +46,10 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+
+ // OpenSSL returns everything twice, the second time in lower case.
+ callback(EVP_aes_128_cbc(), "aes-128-cbc", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "aes-128-cfb", NULL, arg);
+ callback(EVP_aes_192_cbc(), "aes-192-cbc", NULL, arg);
+ callback(EVP_aes_256_cbc(), "aes-256-cbc", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "aes-256-cfb", NULL, arg);
+ callback(EVP_aes_128_ctr(), "aes-128-ctr", NULL, arg);
+ callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg);
+ callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg);
+diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h
+index ba4b6983f5e898b5300ee7a5d683e0cba94682e8..1117a007da931e005b41e9d97672bdfd4eb61449 100644
+--- a/include/openssl/cipher.h
++++ b/include/openssl/cipher.h
+@@ -460,6 +460,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void);
+
+ // EVP_aes_128_cfb128 is only available in decrepit.
+ OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void);
++OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb128(void);
+
+ // EVP_aes_128_cfb is an alias for |EVP_aes_128_cfb128| and is only available in
+ // decrepit.
diff --git a/src/deps/patches/boringssl/expose_blowfish_ciphers.patch b/src/deps/patches/boringssl/expose_blowfish_ciphers.patch
new file mode 100644
index 000000000..cb6239201
--- /dev/null
+++ b/src/deps/patches/boringssl/expose_blowfish_ciphers.patch
@@ -0,0 +1,47 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Rose <nornagon@nornagon.net>
+Date: Wed, 5 Jan 2022 13:08:10 -0800
+Subject: expose blowfish ciphers
+
+This exposes the (decrepit) blowfish cipher family, bf-cbc, bf-cfb and
+bf-ecb through the EVP interface. This adds references to decrepit code
+from non-decrepit code, so upstream is unlikely to take the patch.
+
+diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
+index cfdb69e3c556fea11aa7c2d28d4b7da524df15c3..95bd172c99874610ec9157c52df4fe0232e78c7f 100644
+--- a/crypto/cipher_extra/cipher_extra.c
++++ b/crypto/cipher_extra/cipher_extra.c
+@@ -89,6 +89,9 @@ static const struct {
+ {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
+ {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
+ {NID_aes_256_ofb128, "aes-256-ofb", EVP_aes_256_ofb},
++ {NID_bf_cbc, "bf-cbc", EVP_bf_cbc},
++ {NID_bf_cfb64, "bf-cfb", EVP_bf_cfb},
++ {NID_bf_ecb, "bf-ecb", EVP_bf_ecb},
+ {NID_des_cbc, "des-cbc", EVP_des_cbc},
+ {NID_des_ecb, "des-ecb", EVP_des_ecb},
+ {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
+diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
+index 5e71420b765019edea82a33884ace539cd91bda5..43fc792697519325725e9ce87801c5dc176c70a1 100644
+--- a/decrepit/evp/evp_do_all.c
++++ b/decrepit/evp/evp_do_all.c
+@@ -36,6 +36,9 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_aes_128_gcm(), "AES-128-GCM", NULL, arg);
+ callback(EVP_aes_192_gcm(), "AES-192-GCM", NULL, arg);
+ callback(EVP_aes_256_gcm(), "AES-256-GCM", NULL, arg);
++ callback(EVP_bf_cbc(), "BF-CBC", NULL, arg);
++ callback(EVP_bf_cfb(), "BF-CFB", NULL, arg);
++ callback(EVP_bf_ecb(), "BF-ECB", NULL, arg);
+ callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
+ callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
+ callback(EVP_des_ede(), "DES-EDE", NULL, arg);
+@@ -63,6 +66,9 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_aes_128_gcm(), "aes-128-gcm", NULL, arg);
+ callback(EVP_aes_192_gcm(), "aes-192-gcm", NULL, arg);
+ callback(EVP_aes_256_gcm(), "aes-256-gcm", NULL, arg);
++ callback(EVP_bf_cbc(), "bf-cbc", NULL, arg);
++ callback(EVP_bf_cfb(), "bf-cfb", NULL, arg);
++ callback(EVP_bf_ecb(), "bf-ecb", NULL, arg);
+ callback(EVP_des_cbc(), "des-cbc", NULL, arg);
+ callback(EVP_des_ecb(), "des-ecb", NULL, arg);
+ callback(EVP_des_ede(), "des-ede", NULL, arg);
diff --git a/src/deps/patches/boringssl/expose_des-ede3.patch b/src/deps/patches/boringssl/expose_des-ede3.patch
new file mode 100644
index 000000000..f39665f42
--- /dev/null
+++ b/src/deps/patches/boringssl/expose_des-ede3.patch
@@ -0,0 +1,39 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Rose <nornagon@nornagon.net>
+Date: Wed, 24 Feb 2021 11:08:34 -0800
+Subject: expose des-ede3
+
+This should be upstreamed.
+
+diff --git a/crypto/cipher_extra/cipher_extra.c b/crypto/cipher_extra/cipher_extra.c
+index 0c30b0329d32b94b22f342f95035e927797d0aaf..d97f67fb03756169446edf6b41d3a33fe3ae8205 100644
+--- a/crypto/cipher_extra/cipher_extra.c
++++ b/crypto/cipher_extra/cipher_extra.c
+@@ -93,6 +93,7 @@ static const struct {
+ {NID_des_ecb, "des-ecb", EVP_des_ecb},
+ {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
+ {NID_des_ede_ecb, "des-ede", EVP_des_ede},
++ {NID_des_ede3_ecb, "des-ede3", EVP_des_ede3},
+ {NID_des_ede3_cbc, "des-ede3-cbc", EVP_des_ede3_cbc},
+ {NID_rc2_cbc, "rc2-cbc", EVP_rc2_cbc},
+ {NID_rc4, "rc4", EVP_rc4},
+diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
+index d443f4dc2daea0b7aa86ae75d31d995fae667ba9..5e71420b765019edea82a33884ace539cd91bda5 100644
+--- a/decrepit/evp/evp_do_all.c
++++ b/decrepit/evp/evp_do_all.c
+@@ -39,6 +39,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
+ callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
+ callback(EVP_des_ede(), "DES-EDE", NULL, arg);
++ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg);
+ callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg);
+@@ -65,6 +66,7 @@ void EVP_CIPHER_do_all_sorted(void (*callback)(const EVP_CIPHER *cipher,
+ callback(EVP_des_cbc(), "des-cbc", NULL, arg);
+ callback(EVP_des_ecb(), "des-ecb", NULL, arg);
+ callback(EVP_des_ede(), "des-ede", NULL, arg);
++ callback(EVP_des_ede3(), "des-ede3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg);
+ callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg);
diff --git a/src/deps/patches/boringssl/expose_ripemd160.patch b/src/deps/patches/boringssl/expose_ripemd160.patch
new file mode 100644
index 000000000..fede352bb
--- /dev/null
+++ b/src/deps/patches/boringssl/expose_ripemd160.patch
@@ -0,0 +1,97 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jeremy Apthorp <nornagon@nornagon.net>
+Date: Fri, 18 Jan 2019 13:56:52 -0800
+Subject: expose ripemd160
+
+This adds references to the decrepit/ module from non-decrepit source,
+which is not allowed in upstream. Until upstream has a way to interface
+with node.js that allows exposing additional digests without patching,
+this patch is required to provide ripemd160 support in the nodejs crypto
+module.
+
+diff --git a/crypto/digest_extra/digest_extra.c b/crypto/digest_extra/digest_extra.c
+index 8cbb28e3afde3dbae3887b22e8b607fa7303e89f..32caba196eb9f0823f774dac9e91314035b3ff7f 100644
+--- a/crypto/digest_extra/digest_extra.c
++++ b/crypto/digest_extra/digest_extra.c
+@@ -85,6 +85,7 @@ static const struct nid_to_digest nid_to_digest_mapping[] = {
+ {NID_sha512, EVP_sha512, SN_sha512, LN_sha512},
+ {NID_sha512_256, EVP_sha512_256, SN_sha512_256, LN_sha512_256},
+ {NID_md5_sha1, EVP_md5_sha1, SN_md5_sha1, LN_md5_sha1},
++ {NID_ripemd160, EVP_ripemd160, SN_ripemd160, LN_ripemd160},
+ // As a remnant of signing |EVP_MD|s, OpenSSL returned the corresponding
+ // hash function when given a signature OID. To avoid unintended lax parsing
+ // of hash OIDs, this is no longer supported for lookup by OID or NID.
+diff --git a/crypto/fipsmodule/digest/digests.c b/crypto/fipsmodule/digest/digests.c
+index f006ebbc53eea78ce0337a076a05285f22da7a18..7b9309f39a2e5dc6e61bb89e5d32b1766165f5a7 100644
+--- a/crypto/fipsmodule/digest/digests.c
++++ b/crypto/fipsmodule/digest/digests.c
+@@ -63,6 +63,7 @@
+ #include <openssl/md5.h>
+ #include <openssl/nid.h>
+ #include <openssl/sha.h>
++#include <openssl/ripemd.h>
+
+ #include "internal.h"
+ #include "../delocate.h"
+@@ -301,4 +302,27 @@ DEFINE_METHOD_FUNCTION(EVP_MD, EVP_md5_sha1) {
+ out->ctx_size = sizeof(MD5_SHA1_CTX);
+ }
+
++static void ripemd160_init(EVP_MD_CTX *ctx) {
++ CHECK(RIPEMD160_Init(ctx->md_data));
++}
++
++static void ripemd160_update(EVP_MD_CTX *ctx, const void *data, size_t count) {
++ CHECK(RIPEMD160_Update(ctx->md_data, data, count));
++}
++
++static void ripemd160_final(EVP_MD_CTX *ctx, uint8_t *md) {
++ CHECK(RIPEMD160_Final(md, ctx->md_data));
++}
++
++DEFINE_METHOD_FUNCTION(EVP_MD, EVP_ripemd160) {
++ out->type = NID_ripemd160;
++ out->md_size = RIPEMD160_DIGEST_LENGTH;
++ out->flags = 0;
++ out->init = ripemd160_init;
++ out->update = ripemd160_update;
++ out->final = ripemd160_final;
++ out->block_size = 64;
++ out->ctx_size = sizeof(RIPEMD160_CTX);
++}
++
+ #undef CHECK
+diff --git a/decrepit/evp/evp_do_all.c b/decrepit/evp/evp_do_all.c
+index a3fb077b9b9e66d1bc524fd7987622e73aa4776a..852b76bea69988e0b3ac76a17b603128f239dde0 100644
+--- a/decrepit/evp/evp_do_all.c
++++ b/decrepit/evp/evp_do_all.c
+@@ -79,6 +79,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher,
+ callback(EVP_sha384(), "SHA384", NULL, arg);
+ callback(EVP_sha512(), "SHA512", NULL, arg);
+ callback(EVP_sha512_256(), "SHA512-256", NULL, arg);
++ callback(EVP_ripemd160(), "ripemd160", NULL, arg);
+
+ callback(EVP_md4(), "md4", NULL, arg);
+ callback(EVP_md5(), "md5", NULL, arg);
+@@ -88,6 +89,7 @@ void EVP_MD_do_all_sorted(void (*callback)(const EVP_MD *cipher,
+ callback(EVP_sha384(), "sha384", NULL, arg);
+ callback(EVP_sha512(), "sha512", NULL, arg);
+ callback(EVP_sha512_256(), "sha512-256", NULL, arg);
++ callback(EVP_ripemd160(), "ripemd160", NULL, arg);
+ }
+
+ void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name,
+diff --git a/include/openssl/digest.h b/include/openssl/digest.h
+index 6e889993edc1caa7e10670529dd270c337b5ae4c..f61f7e5009a9b4f5630cda2c3a5a21b44e5b88d8 100644
+--- a/include/openssl/digest.h
++++ b/include/openssl/digest.h
+@@ -90,6 +90,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b256(void);
+ // MD5 and SHA-1, as used in TLS 1.1 and below.
+ OPENSSL_EXPORT const EVP_MD *EVP_md5_sha1(void);
+
++// EVP_ripemd160 is in decrepit and not available by default.
++OPENSSL_EXPORT const EVP_MD *EVP_ripemd160(void);
++
+ // EVP_get_digestbynid returns an |EVP_MD| for the given NID, or NULL if no
+ // such digest is known.
+ OPENSSL_EXPORT const EVP_MD *EVP_get_digestbynid(int nid);
diff --git a/src/deps/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch b/src/deps/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch
new file mode 100644
index 000000000..1b1b4feec
--- /dev/null
+++ b/src/deps/patches/boringssl/revert_track_ssl_error_zero_return_explicitly.patch
@@ -0,0 +1,88 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Shelley Vohr <shelley.vohr@gmail.com>
+Date: Tue, 6 Sep 2022 09:42:52 +0200
+Subject: revert: track SSL_ERROR_ZERO_RETURN explicitly.
+
+This reverts commit ebd8b8965c74ab06bb91f7a00b23822e1f1f26ca.
+
+It is causing significant TLS failures in Node.js.
+
+diff --git a/ssl/ssl_buffer.cc b/ssl/ssl_buffer.cc
+index 2ca14efae5ea478f43794a81883b00dfdb1a37b0..d73055fbf39334925ef4b4804bbaca57c4a4d5d3 100644
+--- a/ssl/ssl_buffer.cc
++++ b/ssl/ssl_buffer.cc
+@@ -232,7 +232,6 @@ int ssl_handle_open_record(SSL *ssl, bool *out_retry, ssl_open_record_t ret,
+ return 1;
+
+ case ssl_open_record_close_notify:
+- ssl->s3->rwstate = SSL_ERROR_ZERO_RETURN;
+ return 0;
+
+ case ssl_open_record_error:
+diff --git a/ssl/ssl_lib.cc b/ssl/ssl_lib.cc
+index cfd1862d4bd031dffb4e7d0cfd0aadcb61200c47..d14c8cd02171daf26ed9460b890b82475d3537c0 100644
+--- a/ssl/ssl_lib.cc
++++ b/ssl/ssl_lib.cc
+@@ -1320,7 +1320,7 @@ int SSL_get_error(const SSL *ssl, int ret_code) {
+ }
+
+ if (ret_code == 0) {
+- if (ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN) {
++ if (ssl->s3->read_shutdown == ssl_shutdown_close_notify) {
+ return SSL_ERROR_ZERO_RETURN;
+ }
+ // An EOF was observed which violates the protocol, and the underlying
+@@ -2598,13 +2598,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx) {
+ return CRYPTO_get_ex_data(&ctx->ex_data, idx);
+ }
+
+-int SSL_want(const SSL *ssl) {
+- // Historically, OpenSSL did not track |SSL_ERROR_ZERO_RETURN| as an |rwstate|
+- // value. We do, but map it back to |SSL_ERROR_NONE| to preserve the original
+- // behavior.
+- return ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE
+- : ssl->s3->rwstate;
+-}
++int SSL_want(const SSL *ssl) { return ssl->s3->rwstate; }
+
+ void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
+ RSA *(*cb)(SSL *ssl, int is_export,
+diff --git a/ssl/ssl_test.cc b/ssl/ssl_test.cc
+index 51366a4fdf73041abd69184fef6bbc99ee5554db..c61bc3c979f9339014d63419034b0897e4f1c3ba 100644
+--- a/ssl/ssl_test.cc
++++ b/ssl/ssl_test.cc
+@@ -8433,11 +8433,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
+ EXPECT_EQ(ret, 0);
+ EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_ZERO_RETURN);
+
+- // Further calls to |SSL_read| continue to report |SSL_ERROR_ZERO_RETURN|.
+- ret = SSL_read(client.get(), buf, sizeof(buf));
+- EXPECT_EQ(ret, 0);
+- EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_ZERO_RETURN);
+-
+ // Although the client has seen close_notify, it should continue to report
+ // |SSL_ERROR_SYSCALL| when its writes fail.
+ ret = SSL_write(client.get(), data, sizeof(data));
+@@ -8445,22 +8440,6 @@ TEST(SSLTest, ErrorSyscallAfterCloseNotify) {
+ EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_SYSCALL);
+ EXPECT_TRUE(write_failed);
+ write_failed = false;
+-
+- // Cause |BIO_write| to fail with a return value of zero instead.
+- // |SSL_get_error| should not misinterpret this as a close_notify.
+- //
+- // This is not actually a correct implementation of |BIO_write|, but the rest
+- // of the code treats zero from |BIO_write| as an error, so ensure it does so
+- // correctly. Fixing https://crbug.com/boringssl/503 will make this case moot.
+- BIO_meth_set_write(method.get(), [](BIO *, const char *, int) -> int {
+- write_failed = true;
+- return 0;
+- });
+- ret = SSL_write(client.get(), data, sizeof(data));
+- EXPECT_EQ(ret, 0);
+- EXPECT_EQ(SSL_get_error(client.get(), ret), SSL_ERROR_SYSCALL);
+- EXPECT_TRUE(write_failed);
+- write_failed = false;
+ }
+
+ // Test that |SSL_shutdown|, when quiet shutdown is enabled, simulates receiving