Skip to content

Commit 5105082

Browse files
committed
addressed review comments
1 parent b84a4e1 commit 5105082

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/tls13.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8421,7 +8421,7 @@ static word32 NextCert(byte* data, word32 length, word32* idx)
84218421
return len;
84228422
}
84238423

8424-
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST)
8424+
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) && !defined(NO_WOLFSSL_SERVER)
84258425
/* Write certificate status request into certificate to buffer.
84268426
*
84278427
* ssl SSL/TLS object.
@@ -8546,7 +8546,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
85468546
{
85478547
int ret = 0;
85488548
word32 certSz, certChainSz, headerSz, listSz, payloadSz;
8549-
word16 extSz[1 + MAX_CERT_EXTENSIONS];
8549+
word16 extSz[MAX_CERT_EXTENSIONS];
85508550
word16 extIdx = 0;
85518551
word32 maxFragment;
85528552
word32 totalextSz = 0;
@@ -8614,7 +8614,7 @@ static int SendTls13Certificate(WOLFSSL* ssl)
86148614
for (extIdx = 0; extIdx < (word16)XELEM_CNT(extSz); extIdx++)
86158615
extSz[extIdx] = OPAQUE16_LEN;
86168616

8617-
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST)
8617+
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) && !defined(NO_WOLFSSL_SERVER)
86188618
/* We only send CSR on the server side. On client side, the CSR data
86198619
* is populated with the server response. We would be sending the server
86208620
* its own stapling data. */
@@ -8747,14 +8747,14 @@ static int SendTls13Certificate(WOLFSSL* ssl)
87478747
if (certSz > 0 && ssl->fragOffset < certSz + extSz[0]) {
87488748
/* Put in the leaf certificate with extensions. */
87498749
word32 copySz = AddCertExt(ssl, ssl->buffers.certificate->buffer,
8750-
certSz, extSz[extIdx], ssl->fragOffset, fragSz,
8751-
output + i, extIdx);
8750+
certSz, extSz[0], ssl->fragOffset, fragSz,
8751+
output + i, 0);
87528752
i += copySz;
87538753
ssl->fragOffset += copySz;
87548754
length -= copySz;
87558755
fragSz -= copySz;
8756-
if (ssl->fragOffset == certSz + extSz[extIdx])
8757-
FreeDer(&ssl->buffers.certExts[extIdx]);
8756+
if (ssl->fragOffset == certSz + extSz[0])
8757+
FreeDer(&ssl->buffers.certExts[0]);
87588758
}
87598759
}
87608760
if (certChainSz > 0 && fragSz > 0) {
@@ -8771,8 +8771,11 @@ static int SendTls13Certificate(WOLFSSL* ssl)
87718771
ssl->buffers.certChain->length, &idx);
87728772
if (len == 0)
87738773
break;
8774+
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) && \
8775+
!defined(NO_WOLFSSL_SERVER)
87748776
if (MAX_CERT_EXTENSIONS > extIdx)
87758777
extIdx++;
8778+
#endif
87768779
}
87778780
/* Write out certificate and extension. */
87788781
l = AddCertExt(ssl, p, len, extSz[extIdx], offset, fragSz,

wolfssl/internal.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,6 +2024,13 @@ enum Misc {
20242024
#define MAX_CHAIN_DEPTH 9
20252025
#endif
20262026

2027+
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) || \
2028+
defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
2029+
#if !defined(HAVE_OCSP)
2030+
#error OCSP Stapling and Stapling V2 needs OCSP. Please define HAVE_OCSP.
2031+
#endif
2032+
#endif
2033+
20272034
/* Max certificate extensions in TLS1.3 */
20282035
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST)
20292036
/* Number of extensions to set each OCSP response */

0 commit comments

Comments
 (0)