[openssl-users] Problem building openssl with mingw

2015-10-17 Thread Евгений Желтоножский

Hello everyone!

I'm trying to build openssl 1.0.1p with x64 mingw-w64 5.1.0.
I run

./Configure --openssldir=$PWD/dist shared mingw64 && make
CC=x86_64-w64-mingw32-gcc RANLIB=ranlib && make install

It's configured as needed and starts to compile. It compiles libcrypto. I get a
libcrypto.a in my openssl folder. But then I get following error:

touch: setting times of `lib': Permission denied

which prevents compile from continue. I'm running Windows 10.
What's the problem?

Evgeniy

.
___
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


how to fix bugs in openssl?

2008-10-16 Thread Евгений
Could I commit my patch to openssl source code to fix bug that I found?
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


bug in gost engine

2008-10-10 Thread Евгений
I found a bug in implementation of gost89 algorithm in gost engine of OpenSSL 
library.

I installed openssl-SNAP-20081006.
Simple program shows an error in decryption of buffer encrypted with gost89 
algorithm.

#include openssl/evp.h
#include stdlib.h


static void
print_buffer(void *buffer, int len)
{
u_int i;
u_char *ucp = buffer;

for (i = 0; i  len; i++) {
printf( %02x, ucp[i]);
if (i%16==15)
printf( \r\n );
else if (i%2==1)
printf(   );
}
printf( \r\n );
}

int
main()
{
OPENSSL_config( NULL );
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();

//
//Initialize key and iv
//
u_char iv[512];
u_char key[512];
int i;
for( i = 0; i  sizeof( iv ); i++ )
{
iv[i] = rand();
key[i] = rand();
}
//
//Initialize cipher context for encryption
//
EVP_CIPHER_CTX encCtx;
EVP_CIPHER_CTX_init( encCtx );
if ( EVP_CipherInit( encCtx, EVP_get_cipherbyname( gost89 ), key, 
iv, 
1 ) )
{
//
//Initialize plain text and cipher text buffers
//
char plainText[32] = { 
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 
30, 31 };
printf( plain text :\n );
print_buffer( plainText, 32 );
char cipherText[32] = ;
//
//Encrypt plaint text
//
if ( EVP_Cipher( encCtx, cipherText, plainText, sizeof( 
cipherText ) ) )
{
printf( cipher text :\n );
print_buffer( cipherText, 32 );
//
//Initialize cipher context for decryption
//
EVP_CIPHER_CTX decCtx;
EVP_CIPHER_CTX_init( decCtx );
if ( EVP_CipherInit( decCtx, EVP_get_cipherbyname( 
gost89 ), key, iv, 
0 ) )
{
char decryptedText[32] = ;
//
//Decrypt first 8 byte block of cipher text
//
if ( EVP_Cipher( decCtx, decryptedText, 
cipherText, 8 ) )
{
printf( decrypted text after first 
block decryption :\n );
print_buffer( decryptedText, 32 );
//
//Decrypt rest of cipher text
//
if ( EVP_Cipher( decCtx, decryptedText 
+ 8, cipherText + 8, 24 ) )
{
printf( decrypted text after 
rest blocks decryption :\n );
print_buffer( decryptedText, 32 
);
//
//Compare plain text with decrypted text
//
if( 0 == memcmp( plainText, 
decryptedText, sizeof( decryptedText ) ) )
{   
printf( Success\n );
}
else
{
printf( Error\n );
}
}
}
}
EVP_CIPHER_CTX_cleanup( decCtx );

}


}

EVP_CIPHER_CTX_cleanup( encCtx );
EVP_cleanup();
ERR_free_strings();
CONF_modules_free();
return 0;
}

The output of the program:

plain text :
0001 0203 0405 0607 0809 0a0b 0c0d 0e0f
1011 1213 1415 1617 1819 1a1b 1c1d 1e1f

cipher text :
fa25 cc1e 8c89 5ec1 1939 af98 b105 fc49
6204 1fcb 4586 35cc bdcd d264 80df 2979

decrypted text after first block decryption :
0001 0203 0405 0607    
       

decrypted text after rest blocks decryption :
0001 0203 0405 0607 c51a dd70 0553 dffb
1011 1213 1415 1617 1819 1a1b 1c1d 1e1f

Error

Cipher text is decryted by two parts.
First block size is 8 bytes. The decryption of it is correct.
The size of rest of cipher text is 24 bytes.
The decrypted text is corrupted (first 8 bytes are not correct, other 16 bytes 
are correct ).
If first block size is 16 bytes, then whole decrypted buffer is correct.
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Problem with openssl-0.9.8e installation

2008-09-16 Thread Евгений
Sorry for my bad english.
I use Ubuntu 8.04.1. There is preinstalled package of openssl version 0.9.8g 
in system. It is installed in /usr. I tried to install openssl version 
0.9.8e. There are steps i did:
1) download library from openssl.org;
2) extract archive;
3) ./config shared --openssldir=/usr/local/openssl-0.9.8e
4) make all test install.
The installation seemed to be successfull.
After this I tried to compile OpenSSH with openssl 0.9.8e,
but script ./configure --with-ssl-dir=/usr/local/openssl-0.9.8e exited with 
error:
checking OpenSSL header version... 90805f (OpenSSL 0.9.8e 23 Feb 2007)
checking OpenSSL library version... 90807f (OpenSSL 0.9.8g 19 Oct 2007)
checking whether OpenSSL's headers match the library... no
configure: error: Your OpenSSL headers do not match your
library. Check config.log for details.
If you are sure your installation is consistent, you can disable the check
by running ./configure --without-openssl-header-check.
Also see contrib/findssl.sh for help identifying header/library mismatches.

Then I tried to compile two simple programs to check header version and 
library version.
header_version.c
#include stdio.h
#include string.h
#include openssl/opensslv.h

int main(void)
{
printf( %x (%s)\n, OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT );
return 0;
}
I compiled it with this command:
gcc -I/usr/local/openssl-0.9.8e/include -L/usr/local/openssl-0.9.8e/lib -o 
header_version header_version.c
Compilation was successfull. Output of the program:
90805f (OpenSSL 0.9.8e 23 Feb 2007)
I think that it is correct.

library_version.c
#include stdio.h
#include string.h
#include openssl/opensslv.h
#include openssl/crypto.h

int main(void) 
{
printf( %x (%s)\n, SSLeay(), SSLeay_version( SSLEAY_VERSION ) );

return 0;
}
I compiled it with this command:
gcc -I/usr/local/openssl-0.9.8e/include -L/usr/local/openssl-0.9.8e/lib -o 
library_version -lcrypto library_version.c
Compilation was sucessfull. Output of the program:
90807f (OpenSSL 0.9.8g 19 Oct 2007)
I think it is strange.

I also tried this command:
gcc -I/usr/local/openssl-0.9.8e/include -o 
library_version /usr/local/openssl-0.9.8e/lib/libcrypto.a library_version.c
Compilation failed because of undefined references.
/tmp/cckK33Rn.o: In function `main':
library_version.c:(.text+0x1a): undefined reference to `SSLeay_version'
library_version.c:(.text+0x21): undefined reference to `SSLeay'
But nm utility shows that such functions exists in libcrypto.a

I compiled it with this command:
gcc -I/usr/local/openssl-0.9.8e/include -o 
library_version /usr/local/openssl-0.9.8e/lib/libcrypto.so library_version.c
Compilation was sucessfull. Output of the program:
90807f (OpenSSL 0.9.8g 19 Oct 2007)
It is not correct.

So, I have 3 questions:
1) Can I use two versions of openssl in my system?
2) Why ld can not find SSLeay_version and SSLeay functions 
in /usr/local/openssl-0.9.8e/lib/libcrypto.a?
3) Why my program library_version.c 
with /usr/local/openssl-0.9.8e/lib/libcrypto.so outputs: 90807f (OpenSSL 
0.9.8g 19 Oct 2007) or what I do wrong?
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]