Skip to content

Commit ede15b4

Browse files
authored
Merge pull request #10137 from JacobBarthelmeh/acert
fix for acert builds
2 parents 32502e9 + f6b0228 commit ede15b4

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
@@ -13620,6 +13620,32 @@ static int CopyBaseEntry(Base_entry** to, Base_entry* from, void* heap)
1362013620
#endif /* (KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA ||
1362113621
* OPENSSL_EXTRA_X509_SMALL) && !IGNORE_NAME_CONSTRAINTS */
1362213622

13623+
#if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS) || \
13624+
defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) || \
13625+
defined(WOLFSSL_ACERT)
13626+
/* Copy an ASN-encoded date (type + length + data) into a WOLFSSL_ASN1_TIME.
13627+
* srcDate: ASN date buffer where [0]=type, [1]=length, [2..]=date bytes.
13628+
* srcDateLen: total length of srcDate (0 means no date present). */
13629+
static void CopyDateToASN1_TIME(const byte* srcDate, int srcDateLen,
13630+
WOLFSSL_ASN1_TIME* dst)
13631+
{
13632+
if (srcDateLen >= 2) {
13633+
/* Clamp the date length to the maximum allowed size.
13634+
* This needs to match the size of WOLFSSL_ASN1_TIME minus the
13635+
* the type and length fields. */
13636+
const int maxSz = CTC_DATE_SIZE - 2;
13637+
const int copySz = (int)min(srcDate[1], maxSz);
13638+
dst->type = srcDate[0];
13639+
dst->length = copySz;
13640+
XMEMCPY(dst->data, &srcDate[2], copySz);
13641+
}
13642+
else {
13643+
dst->length = 0;
13644+
}
13645+
}
13646+
#endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA ||
13647+
* OPENSSL_EXTRA_X509_SMALL || WOLFSSL_ACERT */
13648+
1362313649
#if defined(KEEP_PEER_CERT) || defined(SESSION_CERTS) || \
1362413650
defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
1362513651
void CopyDecodedName(WOLFSSL_X509_NAME* name, DecodedCert* dCert, int nameType)
@@ -13766,27 +13792,6 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
1376613792
}
1376713793
#endif /* WOLFSSL_CERT_REQ */
1376813794

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

0 commit comments

Comments
 (0)