Skip to content

Commit f6b0228

Browse files
fix for acert builds
1 parent 1cd8edb commit f6b0228

File tree

1 file changed

+26
-21
lines changed

1 file changed

+26
-21
lines changed

src/internal.c

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13613,6 +13613,32 @@ static int CopyBaseEntry(Base_entry** to, Base_entry* from, void* heap)
1361313613
#endif /* (KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA ||
1361413614
* OPENSSL_EXTRA_X509_SMALL) && !IGNORE_NAME_CONSTRAINTS */
1361513615

13616+
#if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS) || \
13617+
defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
13618+
defined(WOLFSSL_ACERT)
13619+
/* Copy an ASN-encoded date (type + length + data) into a WOLFSSL_ASN1_TIME.
13620+
* srcDate: ASN date buffer where [0]=type, [1]=length, [2..]=date bytes.
13621+
* srcDateLen: total length of srcDate (0 means no date present). */
13622+
static void CopyDateToASN1_TIME(const byte* srcDate, int srcDateLen,
13623+
WOLFSSL_ASN1_TIME* dst)
13624+
{
13625+
if (srcDateLen >= 2) {
13626+
/* Clamp the date length to the maximum allowed size.
13627+
* This needs to match the size of WOLFSSL_ASN1_TIME minus the
13628+
* the type and length fields. */
13629+
const int maxSz = CTC_DATE_SIZE - 2;
13630+
const int copySz = (int)min(srcDate[1], maxSz);
13631+
dst->type = srcDate[0];
13632+
dst->length = copySz;
13633+
XMEMCPY(dst->data, &srcDate[2], copySz);
13634+
}
13635+
else {
13636+
dst->length = 0;
13637+
}
13638+
}
13639+
#endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA ||
13640+
* OPENSSL_EXTRA_X509_SMALL || WOLFSSL_ACERT */
13641+
1361613642
#if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS) || \
1361713643
defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
1361813644
void CopyDecodedName(WOLFSSL_X509_NAME* name, DecodedCert* dCert, int nameType)
@@ -13759,27 +13785,6 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
1375913785
}
1376013786
#endif /* WOLFSSL_CERT_REQ */
1376113787

13762-
/* Copy an ASN-encoded date (type + length + data) into a WOLFSSL_ASN1_TIME.
13763-
* srcDate: ASN date buffer where [0]=type, [1]=length, [2..]=date bytes.
13764-
* srcDateLen: total length of srcDate (0 means no date present). */
13765-
static void CopyDateToASN1_TIME(const byte* srcDate, int srcDateLen,
13766-
WOLFSSL_ASN1_TIME* dst)
13767-
{
13768-
if (srcDateLen >= 2) {
13769-
/* Clamp the date length to the maximum allowed size.
13770-
* This needs to match the size of WOLFSSL_ASN1_TIME minus the
13771-
* the type and length fields. */
13772-
const int maxSz = CTC_DATE_SIZE - 2;
13773-
const int copySz = (int)min(srcDate[1], maxSz);
13774-
dst->type = srcDate[0];
13775-
dst->length = copySz;
13776-
XMEMCPY(dst->data, &srcDate[2], copySz);
13777-
}
13778-
else {
13779-
dst->length = 0;
13780-
}
13781-
}
13782-
1378313788
/* Copy parts X509 needs from Decoded cert, 0 on success */
1378413789
int CopyDecodedToX509(WOLFSSL_X509* x509, DecodedCert* dCert)
1378513790
{

0 commit comments

Comments
 (0)