Update mbedtls

This commit is contained in:
Nick Chan committed 2024-05-26 14:38:18 +08:00
1 parent ff581a41e9
commit f8319e44f1
3 files changed
+40 -38

No files matched your search

@@ -0,0 +1,36 @@
diff -urN a/common/userpref.c b/common/userpref.c
--- a/common/userpref.c 2024-05-26 14:30:03
+++ b/common/userpref.c 2024-05-26 14:34:24
@@ -870,6 +870,10 @@
/* set key validity */
mbedtls_x509write_crt_set_validity(&cert, notbefore, notafter);
+ /* set subject and issuer name */
+ mbedtls_x509write_crt_set_subject_name(&cert, (const char *)"CN=in.palera.cli.subject,O=palera1n CLI Subject,C=TW");
+ mbedtls_x509write_crt_set_issuer_name(&cert, (const char *)"CN=in.palera.cli.issuer,O=palera1n CLI Issuer,C=TW");
+
/* sign root cert with root private key */
mbedtls_x509write_crt_set_issuer_key(&cert, &root_pkey);
mbedtls_x509write_crt_set_md_alg(&cert, MBEDTLS_MD_SHA1);
@@ -929,6 +933,10 @@
/* set key validity */
mbedtls_x509write_crt_set_validity(&cert, notbefore, notafter);
+ /* set subject and issuer name */
+ mbedtls_x509write_crt_set_subject_name(&cert, (const char *)"CN=in.palera.cli.subject,O=palera1n CLI Subject,C=TW");
+ mbedtls_x509write_crt_set_issuer_name(&cert, (const char *)"CN=in.palera.cli.issuer,O=palera1n CLI Issuer,C=TW");
+
/* sign host cert with root private key */
mbedtls_x509write_crt_set_issuer_key(&cert, &root_pkey);
mbedtls_x509write_crt_set_md_alg(&cert, MBEDTLS_MD_SHA1);
@@ -988,6 +996,10 @@
/* set key validity */
mbedtls_x509write_crt_set_validity(&cert, notbefore, notafter);
+
+ /* set subject and issuer name */
+ mbedtls_x509write_crt_set_subject_name(&cert, (const char *)"CN=in.palera.cli.subject,O=palera1n CLI Subject,C=TW");
+ mbedtls_x509write_crt_set_issuer_name(&cert, (const char *)"CN=in.palera.cli.issuer,O=palera1n CLI Issuer,C=TW");
/* sign device certificate with root private key */
mbedtls_x509write_crt_set_issuer_key(&cert, &root_pkey);
@@ -1,34 +0,0 @@
From a2d012f3ba459f6debe636b576ad9aeab7b3c2aa Mon Sep 17 00:00:00 2001
From: Nick Chan <[email protected]>
Date: Sat, 27 May 2023 23:50:23 +0800
Subject: [PATCH] Allow empty x509 cert issuer
---
library/x509_crt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/library/x509_crt.c b/library/x509_crt.c
index cf62532f2..ef25b3d77 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1061,13 +1061,13 @@ static int x509_crt_parse_der_core(mbedtls_x509_crt *crt,
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) != 0) {
- mbedtls_x509_crt_free(crt);
- return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);
+ /*mbedtls_x509_crt_free(crt);
+ return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_X509_INVALID_FORMAT, ret);*/
}
if ((ret = mbedtls_x509_get_name(&p, p + len, &crt->issuer)) != 0) {
- mbedtls_x509_crt_free(crt);
- return ret;
+ /*mbedtls_x509_crt_free(crt);
+ return ret;*/
}
crt->issuer_raw.len = p - crt->issuer_raw.p;
--
2.39.1