Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: dependencies
run: |
sudo apt update
sudo apt install autotools-dev autoconf automake libtool libssl-dev libnss3-dev libgnutls30
sudo apt install autotools-dev autoconf automake libtool libssl-dev libnss3-dev libmbedtls-dev libgnutls28-dev
- name: gen
run: |
autoreconf -ivf
Expand Down
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright (c) 2005-2022 Alon Bar-Lev <[email protected]>

????-??-?? - Version 1.31.0
* threading: fix mutex handling for cond_wait, thanks to Gleb Popov.
* mbed: initialize certificate early using mbedtls_x509_crt_init.

2023-12-01 - Version 1.30.0
* core: add dynamic loader provider attribute, thanks to Marc Becker.
Expand Down
11 changes: 7 additions & 4 deletions lib/_pkcs11h-crypto-mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ __pkcs11h_crypto_mbedtls_certificate_get_expiration (

(void)global_data;

mbedtls_x509_crt_init(&x509);

/*_PKCS11H_ASSERT (global_data!=NULL); NOT NEEDED*/
_PKCS11H_ASSERT (blob!=NULL);
_PKCS11H_ASSERT (expiration!=NULL);

*expiration = (time_t)0;

memset(&x509, 0, sizeof(x509));
if (0 != mbedtls_x509_crt_parse (&x509, blob, blob_size)) {
goto cleanup;
}
Expand Down Expand Up @@ -134,14 +135,15 @@ __pkcs11h_crypto_mbedtls_certificate_get_dn (

(void)global_data;

mbedtls_x509_crt_init(&x509);

/*_PKCS11H_ASSERT (global_data!=NULL); NOT NEEDED*/
_PKCS11H_ASSERT (blob!=NULL);
_PKCS11H_ASSERT (dn!=NULL);
_PKCS11H_ASSERT (dn_max>0);

dn[0] = '\x0';

memset(&x509, 0, sizeof(x509));
if (0 != mbedtls_x509_crt_parse (&x509, blob, blob_size)) {
goto cleanup;
}
Expand Down Expand Up @@ -176,16 +178,17 @@ __pkcs11h_crypto_mbedtls_certificate_is_issuer (

(void)global_data;

mbedtls_x509_crt_init(&x509_issuer);
mbedtls_x509_crt_init(&x509_cert);

/*_PKCS11H_ASSERT (global_data!=NULL); NOT NEEDED*/
_PKCS11H_ASSERT (issuer_blob!=NULL);
_PKCS11H_ASSERT (cert_blob!=NULL);

memset(&x509_issuer, 0, sizeof(x509_issuer));
if (0 != mbedtls_x509_crt_parse (&x509_issuer, issuer_blob, issuer_blob_size)) {
goto cleanup;
}

memset(&x509_cert, 0, sizeof(x509_cert));
if (0 != mbedtls_x509_crt_parse (&x509_cert, cert_blob, cert_blob_size)) {
goto cleanup;
}
Expand Down
Loading