Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Langley <agl@google.com>2015-09-09 20:22:00 +0300
committerAdam Langley <agl@google.com>2015-09-09 20:54:24 +0300
commita0a8dc208f6169981ea7bd6785a7fc99c25c4263 (patch)
tree72a5cecaf45996b4fe549cda863239d6c6729f54
parentf673831272fb94bb1a2186a3cc0d44a0a66aaa01 (diff)
Move large stack buffer in bssl_shim to heap.
The size of the stack caused by this object is problematic for systems that have smaller stacks because they expect many threads. Change-Id: Ib8f03741f9dd96bf474126f001947f879e50a781 Reviewed-on: https://boringssl-review.googlesource.com/5831 Reviewed-by: Matt Braithwaite <mab@google.com> Reviewed-by: Adam Langley <agl@google.com>
-rw-r--r--ssl/test/bssl_shim.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc
index eb5bdae5..9b7fcd6d 100644
--- a/ssl/test/bssl_shim.cc
+++ b/ssl/test/bssl_shim.cc
@@ -1227,10 +1227,12 @@ static bool DoExchange(ScopedSSL_SESSION *out_session, SSL_CTX *ssl_ctx,
}
if (!config->shim_shuts_down) {
for (;;) {
- uint8_t buf[16384];
+ static const size_t kBufLen = 16384;
+ std::unique_ptr<uint8_t[]> buf(new uint8_t[kBufLen]);
+
// Read only 512 bytes at a time in TLS to ensure records may be
// returned in multiple reads.
- int n = DoRead(ssl.get(), buf, config->is_dtls ? sizeof(buf) : 512);
+ int n = DoRead(ssl.get(), buf.get(), config->is_dtls ? kBufLen : 512);
int err = SSL_get_error(ssl.get(), n);
if (err == SSL_ERROR_ZERO_RETURN ||
(n == 0 && err == SSL_ERROR_SYSCALL)) {
@@ -1263,7 +1265,7 @@ static bool DoExchange(ScopedSSL_SESSION *out_session, SSL_CTX *ssl_ctx,
for (int i = 0; i < n; i++) {
buf[i] ^= 0xff;
}
- if (WriteAll(ssl.get(), buf, n) < 0) {
+ if (WriteAll(ssl.get(), buf.get(), n) < 0) {
return false;
}
}