Skip to content

Use two buffers instead of one buffer in split mode #18

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

Merged
merged 1 commit into from
May 18, 2020
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions src/BearSSLClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ int BearSSLClient::connectSSL(const char* host)
// initialize client context with all algorithms and hardcoded trust anchors
br_ssl_client_init_full(&_sc, &_xc, _TAs, _numTAs);

// set the buffer in split mode
br_ssl_engine_set_buffer(&_sc.eng, _iobuf, sizeof(_iobuf), 1);
br_ssl_engine_set_buffers_bidi(&_sc.eng, _ibuf, sizeof(_ibuf), _obuf, sizeof(_obuf));

// inject entropy in engine
unsigned char entropy[32];
Expand Down
11 changes: 8 additions & 3 deletions src/BearSSLClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
#ifndef _BEAR_SSL_CLIENT_H_
#define _BEAR_SSL_CLIENT_H_

#ifndef BEAR_SSL_CLIENT_IOBUF_SIZE
#define BEAR_SSL_CLIENT_IOBUF_SIZE 8192 + 85 + 325
#ifndef BEAR_SSL_CLIENT_OBUF_SIZE
#define BEAR_SSL_CLIENT_OBUF_SIZE 512 + 85
#endif

#ifndef BEAR_SSL_CLIENT_IBUF_SIZE
#define BEAR_SSL_CLIENT_IBUF_SIZE 8192 + 85 + 325 - BEAR_SSL_CLIENT_OBUF_SIZE
#endif

#include <Arduino.h>
Expand Down Expand Up @@ -78,7 +82,8 @@ class BearSSLClient : public Client {

br_ssl_client_context _sc;
br_x509_minimal_context _xc;
unsigned char _iobuf[BEAR_SSL_CLIENT_IOBUF_SIZE];
unsigned char _ibuf[BEAR_SSL_CLIENT_IBUF_SIZE];
unsigned char _obuf[BEAR_SSL_CLIENT_OBUF_SIZE];
br_sslio_context _ioc;
};

Expand Down