openssl on cygwin bug and patch

Kohn Emil Dan emild@cs.Technion.AC.IL
Sun Sep 26 01:50:00 GMT 2004


Hi all,

I have encountered a problem when using openssl to encrypt binary files
on cygwin.

Here is how to reproduce the problem:

1) When you install cygwin, make sure that the format for text files is
set to DOS
2) Encrypt a binary file (e.g. a .zip file, let's call it file.zip):

openssl enc -bf -in file.zip -out file.zip.enc
(give the password when prompted)

3) Decrypt the file:

openssl enc -bf -d -in file.zip.enc -out file.dec.zip
(give the password when prompted)

4) Compare the original and the decrypted files:
cmp -l file.zip file.dec.zip

You will notice that the files are different.

The problem is caused by the fact that openssl does not use the binary
flag for fopen(). The attached patch attempts to fix the problem.

							Regards,

								Emil
-------------- next part --------------
diff -u -r -w openssl-0.9.7d/crypto/bio/bss_file.c openssl-0.9.7d.work/crypto/bio/bss_file.c
--- openssl-0.9.7d/crypto/bio/bss_file.c	2003-12-27 16:40:50.000000000 +0200
+++ openssl-0.9.7d.work/crypto/bio/bss_file.c	2004-09-26 01:29:54.000000000 +0200
@@ -264,7 +264,7 @@
 			ret=0;
 			break;
 			}
-#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2)
+#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYSNAME_CYGWIN32)
 		if (!(num & BIO_FP_TEXT))
 			strcat(p,"b");
 		else
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list