Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up Starboardizations from BoringSSL #621

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions third_party/boringssl/src/ssl/ssl_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ static_assert((SSL3_ALIGN_PAYLOAD & (SSL3_ALIGN_PAYLOAD - 1)) == 0,

void SSLBuffer::Clear() {

// TODO(b/270864119): clean up direct references to Starboard APIs and use
// OPENSSL_port_* shims everywhere instead.
#ifdef STARBOARD
SbMemoryDeallocate(buf_); // Allocated with malloc().
#else
OPENSSL_port_free(buf_); // Allocated with malloc().
#endif
buf_ = nullptr;
offset_ = 0;
size_ = 0;
Expand All @@ -66,14 +60,8 @@ bool SSLBuffer::EnsureCap(size_t header_len, size_t new_cap) {
// Since this buffer gets allocated quite frequently and doesn't contain any
// sensitive data, we allocate with malloc rather than |OPENSSL_malloc| and
// avoid zeroing on free.
//
// We need to use SbMemoryAllocate in starboard.
uint8_t *new_buf =
#ifdef STARBOARD
(uint8_t *)SbMemoryAllocate(new_cap + SSL3_ALIGN_PAYLOAD - 1);
#else
(uint8_t *)OPENSSL_port_malloc(new_cap + SSL3_ALIGN_PAYLOAD - 1);
#endif
if (new_buf == NULL) {
OPENSSL_PUT_ERROR(SSL, ERR_R_MALLOC_FAILURE);
return false;
Expand All @@ -85,11 +73,7 @@ bool SSLBuffer::EnsureCap(size_t header_len, size_t new_cap) {

if (buf_ != NULL) {
OPENSSL_memcpy(new_buf + new_offset, buf_ + offset_, size_);
#ifdef STARBOARD
SbMemoryDeallocate(buf_); // Allocated with malloc().
#else
OPENSSL_port_free(buf_); // Allocated with malloc().
#endif
}

buf_ = new_buf;
Expand Down