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

WOLFMQTT_EXAMPLE_CERT allowing static or extern cert assignment #354

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .github/workflows/ubuntu-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ jobs:
- name: make
run: make
- name: make check
id: make-check
run: make check
- name: Show logs on failure
if: ${{ failure() && steps.make-check.outcome == 'failure' }}
run: |
more test-suite.log
6 changes: 3 additions & 3 deletions examples/aws/awsiot.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int mStopRead = 0;
#define AWSIOT_PUBLISH_MSG_SZ 400

/* Demo Certificates */
static const char* root_ca =
WOLFMQTT_EXAMPLE_CERT const char* root_ca =
"-----BEGIN CERTIFICATE-----\n"
"MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB\n"
"yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL\n"
Expand Down Expand Up @@ -115,7 +115,7 @@ static const char* device_pub_key =
"-----END PUBLIC KEY-----";
#endif

static const char* device_priv_key =
WOLFMQTT_EXAMPLE_CERT const char* device_priv_key =
#ifndef WOLFSSL_ENCRYPTED_KEYS
"-----BEGIN RSA PRIVATE KEY-----\n"
"MIIEpAIBAAKCAQEAqsAKVhbfQEWblC8PvgubqpJasVoCEsSfvLF4b5DIAsoMeieP\n"
Expand Down Expand Up @@ -177,7 +177,7 @@ static const char* device_priv_key =
"-----END ENCRYPTED PRIVATE KEY-----";
#endif

static const char* device_cert =
WOLFMQTT_EXAMPLE_CERT const char* device_cert =
"-----BEGIN CERTIFICATE-----\n"
"MIIDWjCCAkKgAwIBAgIVANIzUucLFUREa2BiJUXoRv6Z4XaIMA0GCSqGSIb3DQEB\n"
"CwUAME0xSzBJBgNVBAsMQkFtYXpvbiBXZWIgU2VydmljZXMgTz1BbWF6b24uY29t\n"
Expand Down
12 changes: 12 additions & 0 deletions examples/mqttexample.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@
#define DEFAULT_SESS_EXP_INT 0xFFFFFFFF
#endif

/* certs are either static or extern, depending on the specific example */
#ifdef WOLFMQTT_EXTERN_CERT
#undef WOLFMQTT_EXAMPLE_CERT
#define WOLFMQTT_EXAMPLE_CERT /* init extern from mqttexample.h */
extern const char* root_ca;
extern const char* device_cert;
extern const char* device_priv_key;
#else
#undef WOLFMQTT_EXAMPLE_CERT
#define WOLFMQTT_EXAMPLE_CERT static
#endif

/* MQTT Client state */
typedef enum _MQTTCtxState {
WMQ_BEGIN = 0,
Expand Down
Loading