From f70a52ccb388b29f1cbb90d9d29157fa58ca349e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st> Date: Thu, 24 Nov 2011 19:37:04 +0100 Subject: [PATCH] =?UTF-8?q?From=20Martin=20Storsj=C3=B6:=20*=20examples/rs?= =?UTF-8?q?a-decrypt.c=20(main)=20[WIN32]:=20Set=20stdout/stdin=20to=20bin?= =?UTF-8?q?ary=20mode.=20*=20examples/rsa-encrypt.c=20(main):=20Likewise.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rev: nettle/examples/rsa-decrypt.c:1.2 Rev: nettle/examples/rsa-encrypt.c:1.4 --- examples/rsa-decrypt.c | 8 ++++++++ examples/rsa-encrypt.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/examples/rsa-decrypt.c b/examples/rsa-decrypt.c index 5e0ee797..f0233b09 100644 --- a/examples/rsa-decrypt.c +++ b/examples/rsa-decrypt.c @@ -31,6 +31,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#ifdef WIN32 +#include <fcntl.h> +#endif /* string.h must be included before gmp.h */ #include "aes.h" @@ -211,6 +214,11 @@ main(int argc, char **argv) return EXIT_FAILURE; } +#ifdef WIN32 + setmode(0, O_BINARY); + setmode(1, O_BINARY); +#endif + if (!read_version(stdin)) { werror("Bad version number in input file.\n"); diff --git a/examples/rsa-encrypt.c b/examples/rsa-encrypt.c index 2bb556a0..de2b9e5c 100644 --- a/examples/rsa-encrypt.c +++ b/examples/rsa-encrypt.c @@ -31,6 +31,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#ifdef WIN32 +#include <fcntl.h> +#endif /* string.h must be included before gmp.h */ #include "bignum.h" @@ -212,6 +215,11 @@ main(int argc, char **argv) rsa_session_set_encrypt_key(&ctx, &info); +#ifdef WIN32 + setmode(0, O_BINARY); + setmode(1, O_BINARY); +#endif + write_version(stdout); mpz_init(x); -- GitLab