From 0295c70f921f453cc88cb1c877d58708076d6d0c Mon Sep 17 00:00:00 2001 From: Harvey LV Date: Thu, 11 Sep 2025 10:31:51 +0800 Subject: [PATCH] Fix Windows file mode issue for key file updates Change fopen mode from 'r+' to 'rb+' in demo.c to prevent automatic line ending translation on Windows that corrupts LMS key files during counter updates. --- demo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo.c b/demo.c index 583fe13..d5a0860 100644 --- a/demo.c +++ b/demo.c @@ -147,7 +147,7 @@ bool do_rand( void *output, size_t len ) { */ static bool update_private_key( unsigned char *private_key, size_t len_private_key, void *filename) { - FILE *f = fopen( filename, "r+" ); + FILE *f = fopen( filename, "rb+" ); if (!f) { /* Open failed, possibly because the file didn't exist */ f = fopen( filename, "wb" );