Skip to content
Snippets Groups Projects
Commit f70a52cc authored by Martin Storsjö's avatar Martin Storsjö Committed by Niels Möller
Browse files

From Martin Storsjö:

* examples/rsa-decrypt.c (main) [WIN32]: Set stdout/stdin to
binary mode.
* examples/rsa-encrypt.c (main): Likewise.

Rev: nettle/examples/rsa-decrypt.c:1.2
Rev: nettle/examples/rsa-encrypt.c:1.4
parent 788ba4ab
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef WIN32
#include <fcntl.h>
#endif
/* string.h must be included before gmp.h */ /* string.h must be included before gmp.h */
#include "aes.h" #include "aes.h"
...@@ -211,6 +214,11 @@ main(int argc, char **argv) ...@@ -211,6 +214,11 @@ main(int argc, char **argv)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#ifdef WIN32
setmode(0, O_BINARY);
setmode(1, O_BINARY);
#endif
if (!read_version(stdin)) if (!read_version(stdin))
{ {
werror("Bad version number in input file.\n"); werror("Bad version number in input file.\n");
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef WIN32
#include <fcntl.h>
#endif
/* string.h must be included before gmp.h */ /* string.h must be included before gmp.h */
#include "bignum.h" #include "bignum.h"
...@@ -212,6 +215,11 @@ main(int argc, char **argv) ...@@ -212,6 +215,11 @@ main(int argc, char **argv)
rsa_session_set_encrypt_key(&ctx, &info); rsa_session_set_encrypt_key(&ctx, &info);
#ifdef WIN32
setmode(0, O_BINARY);
setmode(1, O_BINARY);
#endif
write_version(stdout); write_version(stdout);
mpz_init(x); mpz_init(x);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment