]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
From Martin Storsjö:
authorMartin Storsjö <martin@martin.st>
Thu, 24 Nov 2011 18:37:04 +0000 (19:37 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 24 Nov 2011 18:37:04 +0000 (19:37 +0100)
* 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

examples/rsa-decrypt.c
examples/rsa-encrypt.c

index 5e0ee7979e0f4ca01173180adea62ae43888bbc2..f0233b090a1372474f98963b627cac80edfb1617 100644 (file)
@@ -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");
index 2bb556a06fb0e07bafe6e26fd45c8d867e2ee8cc..de2b9e5caecf5e2052cf645e718ffad1e15572f4 100644 (file)
@@ -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);