Commit e645bdc2 authored by Martin Storsjö's avatar Martin Storsjö Committed by Niels Möller

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 12ecdf07
...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment