diff --git a/examples/rsa-decrypt.c b/examples/rsa-decrypt.c index 5e0ee7979e0f4ca01173180adea62ae43888bbc2..f0233b090a1372474f98963b627cac80edfb1617 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 2bb556a06fb0e07bafe6e26fd45c8d867e2ee8cc..de2b9e5caecf5e2052cf645e718ffad1e15572f4 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);