Segmentation fault with any SSL library

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Segmentation fault with any SSL library

1,262 Views
BrilliantovKiri
Senior Contributor I

Hello!

We are use Linux-2.6.35.3 on our board with iMX538 CPU.

I write libary for get file SHA1 hash and sign it, this library use OpenSSL, I check work on my PC and not found any problem.

But after running application on board I always get segmentation fault in SSL library on memset, memcpy and other standart functions.

I try different version OpenSSL (0.9.8g from LTIB and 1.0.1e from site), I also check PolarSSL 1.2.6, error present always.

I also try use shared and static SSL library, but this is not change situtation.

But this time I can use HTTPS connection with mini_httpd 1.19 on board, it build with static OpenSSL.

Because I not found in work application on my host I not think what problem in it, I also think what problem is not in SSL library.

How can I found reason this problem?

Thank you and excuse my bad english.

Labels (1)
0 Kudos
3 Replies

696 Views
israelpz
Senior Contributor I

Hi Kirill,

Do you already try cross-compile with the openssl which comes with imx53 ltib package?

I already test this lib and seem to be working fine on the imx53 board. I was able to perform a SHA-512.

Seem the segmentation fault is because with board doesn't have a compatible libc with the one which is using your cross compiler in your PC.

The problem is your libc and not your openssl maybe changing the libc on your board could help.

At any case i recommend try to use the openssl which comes with ltib and install it in your cross-compiler

same goes for your libc.

Other way to do this could be install gcc in the board and compile your program in the board.

Regards,

-Israel.

0 Kudos

696 Views
BrilliantovKiri
Senior Contributor I

I think problem solved, after rebuild without -O2 all work fine.

But minimal code, please see attache, work with -O2.

0 Kudos

696 Views
BrilliantovKiri
Senior Contributor I

Hello, Israel!

Yes, now I use OpenSSL from LTIB and libc from LTIB rootfs:

~ # ls -l /lib/libc*

-rw-r--r--1 1000 1000   1491213 Jul 11  2013 /lib/libc-2.11.1.so
lrwxrwxrwx1 root root        14 Jan  1 00:02 /lib/libc.so.6 -> libc-2.11.1.so

I solve problem with get SHA1 on board after switch SSL-interface EVP_X on SHA1_X.

But now I have same problem with verify file signature, I get Segmentation fault in PEM_read_RSA_PUBKEY, I try use BIO-interface and get Segmentation fault in PEM_read_bio_RSA_PUBKEY

0 Kudos