From 42aa453de8e5d026235697ab496cbebc9da62fc5 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Wed, 28 Nov 2018 13:32:27 +0100 Subject: [PATCH 1/2] Fix private DER output shifted by one byte. --- programs/pkey/key_app_writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/pkey/key_app_writer.c b/programs/pkey/key_app_writer.c index cd0c23064..0450a1710 100644 --- a/programs/pkey/key_app_writer.c +++ b/programs/pkey/key_app_writer.c @@ -175,7 +175,7 @@ static int write_private_key( mbedtls_pk_context *key, const char *output_file ) return( ret ); len = ret; - c = output_buf + sizeof(output_buf) - len - 1; + c = output_buf + sizeof(output_buf) - len; } if( ( f = fopen( output_file, "w" ) ) == NULL ) From 5d662dc018b6e2e36e643bdc271f779e166af7ad Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Wed, 28 Nov 2018 15:12:26 +0100 Subject: [PATCH 2/2] Add ChangeLog entry --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index 07cc87692..d2bd76d9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,9 @@ Bugfix * Remove a duplicate #include in a sample program. Fixed by Masashi Honma #2326. * Reduce stack usage of `mpi_write_hlp()` by eliminating recursion. Fixes #2190. + * Fix private key DER output in the key_app_writer example. File contents + were shifted by one byte, creating an invalid ASN.1 tag. Fixed by + Christian Walther in #2239. Changes * Include configuration file in all header files that use configuration,