Determine whether CRT is initialized or not through raw data pointer
Previously, `mbedtls_x509_crt_der_internal()` used the `version` field
(which is `0` after initialization but strictly greater than 0 once a
CRT has successfully been parsed) to determine whether an
`mbedtls_x509_crt` instance had already been setup.
Preparating for the removal of `version` from the structure, this
commit modifies the code to instead peek at the raw data pointer,
which is NULL as long as the CRT structure hasn't been setup with a CRT,
and will be kept in the new CRT structure.
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 8ac7dd4..9aef69a 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -2955,7 +2955,7 @@
#endif
crt = ssl->conf->ca_chain;
- while( crt != NULL && crt->version != 0 )
+ while( crt != NULL && crt->raw.p != NULL )
{
dn_size = crt->subject_raw.len;