Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Remove header guard hack for Arduino v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maakbaas committed Jun 13, 2021
1 parent b2bf375 commit 8a752f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/certStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

namespace BearSSL {

void CertStore::installCertStore(br_x509_minimal_context *ctx) {
void CertStoreP::installCertStore(br_x509_minimal_context *ctx) {
br_x509_minimal_set_dynamic(ctx, (void*)this, findHashedTA, freeHashedTA);
}

const br_x509_trust_anchor *CertStore::findHashedTA(void *ctx, void *hashed_dn, size_t len) {
const br_x509_trust_anchor *CertStoreP::findHashedTA(void *ctx, void *hashed_dn, size_t len) {
//compare sha256 from index file with hashed_dn
//then return certificate

CertStore *cs = static_cast<CertStore *>(ctx);
CertStoreP *cs = static_cast<CertStoreP *>(ctx);

if (!cs || len != 32)
{
Expand Down Expand Up @@ -49,8 +49,8 @@ const br_x509_trust_anchor *CertStore::findHashedTA(void *ctx, void *hashed_dn,
return nullptr;
}

void CertStore::freeHashedTA(void *ctx, const br_x509_trust_anchor *ta) {
CertStore *cs = static_cast<CertStore*>(ctx);
void CertStoreP::freeHashedTA(void *ctx, const br_x509_trust_anchor *ta) {
CertStoreP *cs = static_cast<CertStoreP*>(ctx);
(void) ta; // Unused
delete cs->_x509;
cs->_x509 = nullptr;
Expand Down
9 changes: 5 additions & 4 deletions src/certStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
//the class is completely overwritten by using the same preprocessor
//include guard

#ifndef _CERTSTORE_BEARSSL_H
#define _CERTSTORE_BEARSSL_H
#ifndef _CERTSTORE_H
#define _CERTSTORE_H

#include <Arduino.h>
#include <BearSSLHelpers.h>
#include <bearssl/bearssl.h>
#include <CertStoreBearSSL.h>

namespace BearSSL {

class CertStore {
class CertStoreP: public CertStoreBase {
public:
CertStore() { };
CertStoreP() { };

// Installs the cert store into the X509 decoder (normally via static function callbacks)
void installCertStore(br_x509_minimal_context *ctx);
Expand Down
2 changes: 1 addition & 1 deletion src/fetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HTTPRequest
void addHeader(String name, String value);

private :
BearSSL::CertStore certStore;
BearSSL::CertStoreP certStore;

HTTPClient *http;
WiFiClient *client;
Expand Down

0 comments on commit 8a752f8

Please sign in to comment.