mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-11-07 00:02:56 +00:00
Merge pull request #10994 from saadgodikat/backport-10973-3.6
[3.6] Fix DER certificate output on Windows
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Bugfix
|
||||
* Fix corruption of DER certificates generated by the `cert_write`
|
||||
sample program on Windows. #10152
|
||||
@@ -235,7 +235,11 @@ static int write_certificate(mbedtls_x509write_cert *crt, const char *output_fil
|
||||
output_start = output_buf;
|
||||
}
|
||||
|
||||
if ((f = fopen(output_file, "w")) == NULL) {
|
||||
/*
|
||||
* DER output is binary data. Use binary mode on Windows to prevent
|
||||
* text-mode newline translation.
|
||||
*/
|
||||
if ((f = fopen(output_file, opt.format == FORMAT_DER ? "wb" : "w")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user