Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit 2947a54

Browse files
authored
v1.4.5 to Sync with SSLClient v1.6.11
### Releases v1.4.5 1. Sync with [SSLClient v1.6.11](https://github.com/OPEnSLab-OSU/SSLClient/releases/tag/v1.6.11). Check [Pull in OPEnSLab-OSU's SSLClient v1.6.11 #17](khoih-prog/EthernetWebServer_SSL#17) 2. Add example [AWS_IoT](examples/AWS_IoT)
1 parent a830e24 commit 2947a54

File tree

2 files changed

+316
-316
lines changed

2 files changed

+316
-316
lines changed

src/SSLClient/SSLClient.h

+32-32
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
Check out README.md for more info.
3131
*/
3232

33-
class EthernetSSLClient : public Client
33+
class EthernetSSLClient : public Client
3434
{
3535
public:
3636
/**
@@ -41,7 +41,7 @@ class EthernetSSLClient : public Client
4141
checking the errors, you can do so with EthernetSSLClient::getWriteError(),
4242
which will return one of these values.
4343
*/
44-
enum Error
44+
enum Error
4545
{
4646
SSL_OK = 0,
4747
/** The underlying client failed to connect, probably not an issue with SSL */
@@ -64,7 +64,7 @@ class EthernetSSLClient : public Client
6464
Use these values when initializing EthernetSSLClient to set how many logs you
6565
would like to see in the Serial monitor.
6666
*/
67-
enum DebugLevel
67+
enum DebugLevel
6868
{
6969
/** No logging output */
7070
SSL_NONE = 0,
@@ -209,9 +209,9 @@ class EthernetSSLClient : public Client
209209
fails to become ready for writing data.
210210
*/
211211
size_t write(const uint8_t *buf, size_t size) override;
212-
212+
213213
/** @see EthernetSSLClient::write(uint8_t*, size_t) */
214-
size_t write(uint8_t b) override
214+
size_t write(uint8_t b) override
215215
{
216216
return write(&b, 1);
217217
}
@@ -262,10 +262,10 @@ class EthernetSSLClient : public Client
262262
@brief Read a single byte, or -1 if none is available.
263263
@see EthernetSSLClient::read(uint8_t*, size_t)
264264
*/
265-
int read() override
265+
int read() override
266266
{
267267
uint8_t read_val;
268-
268+
269269
return read(&read_val, 1) > 0 ? read_val : -1;
270270
};
271271

@@ -358,7 +358,7 @@ class EthernetSSLClient : public Client
358358
359359
@returns The SessionCache template parameter.
360360
*/
361-
size_t getSessionCount() const
361+
size_t getSessionCount() const
362362
{
363363
return m_sessions.size();
364364
}
@@ -368,13 +368,13 @@ class EthernetSSLClient : public Client
368368
369369
@returns true if connected, false if not
370370
*/
371-
operator bool()
371+
operator bool()
372372
{
373373
return connected() > 0;
374374
}
375375

376376
/** @brief Returns a reference to the client object stored in this class. Take care not to break it. */
377-
Client& getClient()
377+
Client& getClient()
378378
{
379379
return m_client;
380380
}
@@ -383,7 +383,7 @@ class EthernetSSLClient : public Client
383383
@brief Set the timeout when waiting for an SSL response.
384384
@param t The timeout value, in milliseconds (defaults to 30 seconds if not set). Do not set to zero.
385385
*/
386-
void setTimeout(unsigned int t)
386+
void setTimeout(unsigned int t)
387387
{
388388
m_timeout = t;
389389
}
@@ -392,33 +392,33 @@ class EthernetSSLClient : public Client
392392
@brief Get the timeout when waiting for an SSL response.
393393
@returns The timeout value in milliseconds.
394394
*/
395-
unsigned int getTimeout() const
395+
unsigned int getTimeout() const
396396
{
397397
return m_timeout;
398398
}
399-
399+
400400
/**
401-
@brief Change the time used during x509 verification to a different value.
401+
@brief Change the time used during x509 verification to a different value.
402402
403-
This function directly calls br_x509_minimal_set_time to change the validation
404-
time used by the minimal verification engine. You can use this function if the default value
405-
of the compile time is causing issues. See https://bearssl.org/apidoc/bearssl__x509_8h.html#a7f3558b1999ce904084d578700b1002c
406-
for more information what this function does and how to use it.
403+
This function directly calls br_x509_minimal_set_time to change the validation
404+
time used by the minimal verification engine. You can use this function if the default value
405+
of the compile time is causing issues. See https://bearssl.org/apidoc/bearssl__x509_8h.html#a7f3558b1999ce904084d578700b1002c
406+
for more information what this function does and how to use it.
407407
408-
@param days Days are counted in a proleptic Gregorian calendar since January 1st, 0 AD.
409-
@param seconds Seconds are counted since midnight, from 0 to 86400 (a count of 86400 is possible only if a leap second happened).
408+
@param days Days are counted in a proleptic Gregorian calendar since January 1st, 0 AD.
409+
@param seconds Seconds are counted since midnight, from 0 to 86400 (a count of 86400 is possible only if a leap second happened).
410410
*/
411-
411+
412412
void setVerificationTime(uint32_t days, uint32_t seconds);
413413

414414
private:
415415
/** @brief Returns an instance of m_client that is polymorphic and can be used by EthernetSSLClient */
416-
Client& get_arduino_client()
416+
Client& get_arduino_client()
417417
{
418418
return m_client;
419419
}
420-
421-
const Client& get_arduino_client() const
420+
421+
const Client& get_arduino_client() const
422422
{
423423
return m_client;
424424
}
@@ -448,12 +448,12 @@ class EthernetSSLClient : public Client
448448

449449
/** @brief debugging print function, only prints if m_debug is true */
450450
template<typename T>
451-
void m_print(const T str, const char* func_name, const DebugLevel level) const
451+
void m_print(const T str, const char* func_name, const DebugLevel level) const
452452
{
453453
// check the current debug level and serial status
454-
if (level > m_debug || !Serial)
454+
if (level > m_debug || !Serial)
455455
return;
456-
456+
457457
// print prefix
458458
m_print_prefix(func_name, level);
459459
// print the message
@@ -462,19 +462,19 @@ class EthernetSSLClient : public Client
462462

463463
/** @brief Prints a info message to serial, if info messages are enabled */
464464
template<typename T>
465-
void m_info(const T str, const char* func_name) const
465+
void m_info(const T str, const char* func_name) const
466466
{
467467
m_print(str, func_name, SSL_INFO);
468468
}
469469

470470
template<typename T>
471-
void m_warn(const T str, const char* func_name) const
471+
void m_warn(const T str, const char* func_name) const
472472
{
473473
m_print(str, func_name, SSL_WARN);
474474
}
475475

476476
template<typename T>
477-
void m_error(const T str, const char* func_name) const
477+
void m_error(const T str, const char* func_name) const
478478
{
479479
m_print(str, func_name, SSL_ERROR);
480480
}
@@ -484,7 +484,7 @@ class EthernetSSLClient : public Client
484484
//============================================
485485
// create a reference the client
486486
Client& m_client;
487-
487+
488488
// also store an array of SSLSessions, so we can resume communication with multiple websites
489489
std::vector<SSLSession> m_sessions;
490490
// as well as the maximmum number of sessions we can store
@@ -517,7 +517,7 @@ class EthernetSSLClient : public Client
517517
unsigned char m_iobuf[2048];
518518
//unsigned char m_iobuf[4096];
519519
//////
520-
520+
521521
// store the index of where we are writing in the buffer
522522
// so we can send our records all at once to prevent
523523
// weird timing issues

0 commit comments

Comments
 (0)