cross compiling for ARM running Android

2011-06-16 Thread Nahid Alam
Hi,

I am using OpenSSL 0.9.8k to write a simple AES encryption application that
works fine in x86. It uses EVP library APIs for encryption/decryption
purpose.

Now I need to compile it for Tegra2 (ARM) which is running Android 2.2
I am using Code Sourcery to cross compile for ARM using

$arm-none-linux-gnueabi-gcc  -lcrypto  -o test test.c

But getting fatal error: openssl/evp.h: No such file or directory

Any ideas? Do I need to cross compile openssl 1st?
-- 
Regards
Nahid


Re: cross compiling for ARM running Android

2011-06-16 Thread Michael S. Zick
On Thu June 16 2011, Nahid Alam wrote:
 Hi,
 
 I am using OpenSSL 0.9.8k to write a simple AES encryption application that
 works fine in x86. It uses EVP library APIs for encryption/decryption
 purpose.
 
 Now I need to compile it for Tegra2 (ARM) which is running Android 2.2
 I am using Code Sourcery to cross compile for ARM using
 
 $arm-none-linux-gnueabi-gcc  -lcrypto  -o test test.c
 
 But getting fatal error: openssl/evp.h: No such file or directory
 
 Any ideas? 


Fix your include path (-I )

That is:
Check the paths being searched by arm-none-linux-gnueabi-gcc (there is an 
option for that);
Check what the path is to where you installed the OpenSSl package headers.

 Do I need to cross compile openssl 1st? 


If including anything other than the text header files, yes.

Just stating the library requirement (-l) will not get the
library cross-compiled.

Mike

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: cross compiling for ARM running Android

2011-06-16 Thread Michael S. Zick
On Thu June 16 2011, Michael S. Zick wrote:
 On Thu June 16 2011, Nahid Alam wrote:
  Hi,
  
  I am using OpenSSL 0.9.8k to write a simple AES encryption application that
  works fine in x86. It uses EVP library APIs for encryption/decryption
  purpose.
  
  Now I need to compile it for Tegra2 (ARM) which is running Android 2.2
  I am using Code Sourcery to cross compile for ARM using
  
  $arm-none-linux-gnueabi-gcc  -lcrypto  -o test test.c
  
  But getting fatal error: openssl/evp.h: No such file or directory
  
  Any ideas? 
 
 
 Fix your include path (-I )
 
 That is:
 Check the paths being searched by arm-none-linux-gnueabi-gcc (there is an 
 option for that);
 Check what the path is to where you installed the OpenSSl package headers.


An example for MIPS, CS ARM should be similar:
http://openplayer.org/resource/tutorials/57-cs-multi-library-tour.html
 
  Do I need to cross compile openssl 1st? 
 
 
 If including anything other than the text header files, yes.
 
 Just stating the library requirement (-l) will not get the
 library cross-compiled.
 
 Mike
 
 


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: Help with PKCS7 format

2011-06-16 Thread Claudiu Stanciu
Thanks for the answer and for clearing things, but I actually managed to do it 
last weekend. It was a delay in posting on the forum. But really thanks, 
because now I see that I have done things right.


RE: SSL_ERROR_SYSCALL in SSL_accept

2011-06-16 Thread Dave Thompson
   From: owner-openssl-us...@openssl.org On Behalf Of Saikat Debnath
   Sent: Wednesday, 15 June, 2011 10:59

   I am using openssl-1.0.0d version and having error in SSL_accept.
   SSL_accept() returns -1 which is SSL_ERROR_SYSCALL with 
 errno 2 (No such file or directory) and
   ERR_error_string() retuns 
   error::lib(0):func(0):reason(0)

SSL_ERROR_SYSCALL is 5 not -1, and SSL_accept never returns it.
If SSL_accept returns 0 then you should call SSL_get_error;
THAT may return 5 SSL_ERROR_SYSCALL and if so you should check 
both errno (or WSAGetLastError() on Windows) and the errorqueue.

ERR_error_string only works for an errorcode from the errorqueue 
e.g. from ERR_get_error, NOT a return value from SSL_accept or 
SSL_get_error or a value of errno or WSAGetLastError.
For errno you can use strerror (or perror). For WSAGetLastError 
you can use FormatMessage, but I find it much less convenient.

Are you giving SSL_accept a valid SSL object with a valid socket 
(or perhaps other BIO)? Are you using blocking or nonblocking? 
If you can reduce your code to a minimal program with no outside 
dependencies that still exhibits the error, post it.



__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: 1.0.0d Command Line ENC

2011-06-16 Thread Dave Thompson
   From: owner-openssl-us...@openssl.org On Behalf Of Kurtis Golding
   Sent: Tuesday, 14 June, 2011 23:45

   I have been working with the latest release (1.0.0d) and the 
 command line tool, however, I am having some difficulty. 
snips
   openssl+.exe des3 -in T1.txt -out T2.txt
   ... prompts for a password however, the out file is 
 never created. No errors, actually no output of any kind.
   [using enc -des3] just causes some directions to appear.
   I was also having some difficulty using the -pass parameter, 
 however, -k seems to work ok. using -pass pass:test causes a path
exception..

   Anyway, I was starting to suspect that the command line tool 
 has changed ... or I am missing something :(...

   Thanks for any suggestions..

There has been no change I can see in this area, and all cases 
you give or mention work for me in 1.0.0d same as older versions.

This really sounds like something screwing up the commandline 
even before openssl gets it. What OS and command processor 
are you using (e.g. Unix shell or Windows CMD or what?) What 
openssl build are you using? In particular AFAIK no standard 
build produces an executable with a plussign in the name. Are 
you using any kind of input device or modifier that might fix 
special characters or expand abbreviations/macros or suchlike? 

I assume you are using exactly T1.txt and T2.txt (and T1.txt 
exists and contains data). If you sanitized those names and 
are on Windows, remember that certain filenames on Windows 
that were devices in the days of DOS a decade ago don't work.
http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx 

Try command _input_ rather than command line: either run your 
executable and type a command to the OpenSSL prompt; or 
pipe or redirect from a file containing the command e.g. 
  echo des3 -in t1.txt -out t2.txt | openssl 
  openssl cmdfile # cmdfile contains that command
  # for that latter one, dump the file to check it contains 
  # exactly and only the desired command (if possible) 
Note these only work for commands that don't use stdin for data; 
your two examples satisfy this, but some other cases don't.

Or put the one-line commandline (executable plus arguments) 
in a Unix script or Windows batch file, making sure it's 
exactly right, and invoke that. Especially if you're using 
an unusual shell on Unix, use plain /bin/sh for the script. 
And env -i to drop any weirdness in the environment variables.


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: cross compiling for ARM running Android

2011-06-16 Thread Mike Mohr
Please have a look at the NDK documentation.  You need to extract the
toolchain using a provided script which targets the appropriate API level.
The codesourcery toolchain does not target the correct libc.
On Jun 16, 2011 9:43 AM, Nahid Alam sha...@gmail.com wrote:
 Hi,

 I am using OpenSSL 0.9.8k to write a simple AES encryption application
that
 works fine in x86. It uses EVP library APIs for encryption/decryption
 purpose.

 Now I need to compile it for Tegra2 (ARM) which is running Android 2.2
 I am using Code Sourcery to cross compile for ARM using

 $arm-none-linux-gnueabi-gcc -lcrypto -o test test.c

 But getting fatal error: openssl/evp.h: No such file or directory

 Any ideas? Do I need to cross compile openssl 1st?
 --
 Regards
 Nahid