Skip to content

Commit a41e2f9

Browse files
committed
Address comments and add new CI for mac
1 parent 7db5012 commit a41e2f9

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,34 @@ jobs:
5050
run: |
5151
cd build
5252
./tst/webrtc_client_test
53+
mac-os-build-clang-openssl-old:
54+
runs-on: macos-11
55+
env:
56+
CC: /usr/bin/clang
57+
CXX: /usr/bin/clang++
58+
AWS_KVS_LOG_LEVEL: 2
59+
LDFLAGS: -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
60+
CPATH: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
61+
permissions:
62+
id-token: write
63+
contents: read
64+
steps:
65+
- name: Clone repository
66+
uses: actions/checkout@v3
67+
- name: Configure AWS Credentials
68+
uses: aws-actions/configure-aws-credentials@v2
69+
with:
70+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
71+
aws-region: ${{ secrets.AWS_REGION }}
72+
- name: Build repository
73+
run: |
74+
mkdir build && cd build
75+
cmake .. -DBUILD_TEST=TRUE -DCOMPILER_WARNINGS=TRUE -DBUILD_OLD_OPENSSL_VERSION=ON
76+
make
77+
- name: Run tests
78+
run: |
79+
cd build
80+
./tst/webrtc_client_test
5381
mac-os-build-gcc:
5482
runs-on: macos-11
5583
env:
@@ -76,6 +104,32 @@ jobs:
76104
run: |
77105
cd build
78106
./tst/webrtc_client_test
107+
mac-os-build-gcc-openssl-old:
108+
runs-on: macos-11
109+
env:
110+
CC: gcc
111+
CXX: g++
112+
AWS_KVS_LOG_LEVEL: 2
113+
permissions:
114+
id-token: write
115+
contents: read
116+
steps:
117+
- name: Clone repository
118+
uses: actions/checkout@v3
119+
- name: Configure AWS Credentials
120+
uses: aws-actions/configure-aws-credentials@v2
121+
with:
122+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
123+
aws-region: ${{ secrets.AWS_REGION }}
124+
- name: Build repository
125+
run: |
126+
mkdir build && cd build
127+
cmake .. -DBUILD_TEST=TRUE -DCOMPILER_WARNINGS=TRUE -DBUILD_OLD_OPENSSL_VERSION=ON
128+
make
129+
- name: Run tests
130+
run: |
131+
cd build
132+
./tst/webrtc_client_test
79133
static-build-mac:
80134
runs-on: macos-11
81135
env:

src/source/Crypto/Dtls_openssl.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,20 @@ STATUS createCertificateAndKey(INT32 certificateBits, BOOL generateRSACertificat
106106
STATUS retStatus = STATUS_SUCCESS;
107107
X509_NAME* pX509Name = NULL;
108108
UINT64 certSn;
109-
109+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
110+
EVP_PKEY_CTX* pctx = NULL;
111+
#else
112+
RSA* pRsa = NULL;
113+
BIGNUM* pBne = NULL;
114+
UINT32 eccGroup = 0;
115+
EC_KEY* eccKey = NULL;
116+
#endif
110117
CHK(ppCert != NULL && ppPkey != NULL, STATUS_NULL_ARG);
111118
CHK((*ppPkey = EVP_PKEY_new()) != NULL, STATUS_CERTIFICATE_GENERATION_FAILED);
112119
CHK_STATUS(dtlsFillPseudoRandomBits((PBYTE) &certSn, SIZEOF(UINT64)));
113120

114121
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
115122
DLOGI("Detected openssl version greater than 3.0.0");
116-
EVP_PKEY_CTX* pctx = NULL;
117123
if (generateRSACertificate) {
118124
DLOGI("Using RSA");
119125
CHK_ERR(pctx = EVP_PKEY_CTX_new_from_name(NULL, "RSA", NULL), STATUS_CERTIFICATE_GENERATION_FAILED, "Error creating EVP_PKEY_CTX for RSA");
@@ -130,9 +136,7 @@ STATUS createCertificateAndKey(INT32 certificateBits, BOOL generateRSACertificat
130136
}
131137
EVP_PKEY_CTX_free(pctx);
132138
#else
133-
RSA* pRsa = NULL;
134139
if (generateRSACertificate) {
135-
BIGNUM* pBne = NULL;
136140
DLOGI("Detected older version");
137141
CHK((pBne = BN_new()) != NULL, STATUS_CERTIFICATE_GENERATION_FAILED);
138142
CHK(BN_set_word(pBne, KVS_RSA_F4) != 0, STATUS_CERTIFICATE_GENERATION_FAILED);
@@ -144,8 +148,6 @@ STATUS createCertificateAndKey(INT32 certificateBits, BOOL generateRSACertificat
144148
}
145149
pRsa = NULL;
146150
} else {
147-
UINT32 eccGroup = 0;
148-
EC_KEY* eccKey = NULL;
149151
CHK((eccGroup = OBJ_txt2nid("prime256v1")) != NID_undef, STATUS_CERTIFICATE_GENERATION_FAILED);
150152
CHK((eccKey = EC_KEY_new_by_curve_name(eccGroup)) != NULL, STATUS_CERTIFICATE_GENERATION_FAILED);
151153

0 commit comments

Comments
 (0)