Re: cross compiling for ARM running Android

2011-06-21 Thread Nahid Alam
OK, so finally it worked :)
Just download Android source, compile it targeting the ARM architecture.
Android has openssl in PATH_TO_ANDROID_BUILD/external/openssl
put you code in the appropriate place, compile, push it to your android
device and run

No need for Code Sourcery
Also, I don't think NDK is useful in this case as it doesn't include OpenSSL
support at this point.

On Mon, Jun 20, 2011 at 2:35 PM, Nahid Alam sha...@gmail.com wrote:



 On Mon, Jun 20, 2011 at 2:17 PM, Dave Thompson dthomp...@prinpay.comwrote:

From: owner-openssl-us...@openssl.org On Behalf Of Nahid Alam
Sent: Saturday, 18 June, 2011 19:00

So I cross compiled OpenSSL following the link
  http://www.crosscompile.org/static/pages/OpenSSL.html

 That uses the 'dist' config with minimal tool changes,
 which does static libraries (presumably) because there
 is no single portable way to do shared libraries.
 The only Configure case I see for ARM is linux-armv4
 and it does do linux-shared, but I have no idea if that
 works correctly on your target, or if you even want it.


 Can you please share how to do it?


And used the following command
$ arm-none-linux-gnueabi-gcc -Wall -I/PATH_TO_INCLUDE_HEADER
  -L/PATH_TO_CROSS_COMPILED_OpenSSL_LIB  -lssl -lcrypto -o test test.c
But getting the errors:
openssl-arm-aes.c: In function 'main':
openssl-arm-aes.c:44:10: warning: unused variable 'e'
/tmp/ccaF9kYf.o: In function `time_aes':
openssl-arm-aes.c:(.text+0x1cc): undefined reference to
 `EVP_CIPHER_CTX_init'
 snip rest
Looks like I am missing something really silly. Any suggestion?

 And most C implementations including gcc at least for
 a static library, the library must be in the (linker)
 command line AFTER the module(s) that reference it.
 Also you don't need -lssl for EVP_* (but it doesn't hurt).

 But gcc (and binutils) should display your actual source
 filename, allegedly 'test.c'. Unless you just changed
 'openssl-arm-aes.c' to 'test.c' for posting.


  Yes, I just put test.c to reduce the length of the command :)




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




 --
 Regards
 Nahid





-- 
Regards
Nahid


RE: cross compiling for ARM running Android

2011-06-20 Thread Dave Thompson
   From: owner-openssl-us...@openssl.org On Behalf Of Nahid Alam
   Sent: Saturday, 18 June, 2011 19:00

   So I cross compiled OpenSSL following the link  
 http://www.crosscompile.org/static/pages/OpenSSL.html

That uses the 'dist' config with minimal tool changes, 
which does static libraries (presumably) because there 
is no single portable way to do shared libraries. 
The only Configure case I see for ARM is linux-armv4 
and it does do linux-shared, but I have no idea if that 
works correctly on your target, or if you even want it.

   And used the following command
   $ arm-none-linux-gnueabi-gcc -Wall -I/PATH_TO_INCLUDE_HEADER   
 -L/PATH_TO_CROSS_COMPILED_OpenSSL_LIB  -lssl -lcrypto -o test test.c 
   But getting the errors:
   openssl-arm-aes.c: In function 'main':
   openssl-arm-aes.c:44:10: warning: unused variable 'e'
   /tmp/ccaF9kYf.o: In function `time_aes':
   openssl-arm-aes.c:(.text+0x1cc): undefined reference to
`EVP_CIPHER_CTX_init'
snip rest
   Looks like I am missing something really silly. Any suggestion?

And most C implementations including gcc at least for 
a static library, the library must be in the (linker) 
command line AFTER the module(s) that reference it. 
Also you don't need -lssl for EVP_* (but it doesn't hurt).

But gcc (and binutils) should display your actual source 
filename, allegedly 'test.c'. Unless you just changed 
'openssl-arm-aes.c' to 'test.c' for posting.



__
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-20 Thread Nahid Alam
On Mon, Jun 20, 2011 at 2:17 PM, Dave Thompson dthomp...@prinpay.comwrote:

From: owner-openssl-us...@openssl.org On Behalf Of Nahid Alam
Sent: Saturday, 18 June, 2011 19:00

So I cross compiled OpenSSL following the link
  http://www.crosscompile.org/static/pages/OpenSSL.html

 That uses the 'dist' config with minimal tool changes,
 which does static libraries (presumably) because there
 is no single portable way to do shared libraries.
 The only Configure case I see for ARM is linux-armv4
 and it does do linux-shared, but I have no idea if that
 works correctly on your target, or if you even want it.


Can you please share how to do it?


And used the following command
$ arm-none-linux-gnueabi-gcc -Wall -I/PATH_TO_INCLUDE_HEADER
  -L/PATH_TO_CROSS_COMPILED_OpenSSL_LIB  -lssl -lcrypto -o test test.c
But getting the errors:
openssl-arm-aes.c: In function 'main':
openssl-arm-aes.c:44:10: warning: unused variable 'e'
/tmp/ccaF9kYf.o: In function `time_aes':
openssl-arm-aes.c:(.text+0x1cc): undefined reference to
 `EVP_CIPHER_CTX_init'
 snip rest
Looks like I am missing something really silly. Any suggestion?

 And most C implementations including gcc at least for
 a static library, the library must be in the (linker)
 command line AFTER the module(s) that reference it.
 Also you don't need -lssl for EVP_* (but it doesn't hurt).

 But gcc (and binutils) should display your actual source
 filename, allegedly 'test.c'. Unless you just changed
 'openssl-arm-aes.c' to 'test.c' for posting.


 Yes, I just put test.c to reduce the length of the command :)




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




-- 
Regards
Nahid


Re: cross compiling for ARM running Android

2011-06-18 Thread Nahid Alam
Hi,

So I cross compiled OpenSSL following the link
http://www.crosscompile.org/static/pages/OpenSSL.html
And used the following command

$ *arm-none-linux-gnueabi-gcc -Wall -I/PATH_TO_INCLUDE_HEADER
 -L/PATH_TO_CROSS_COMPILED_OpenSSL_LIB  -lssl -lcrypto -o test test.c *

But getting the errors:
openssl-arm-aes.c: In function 'main':
openssl-arm-aes.c:44:10: warning: unused variable 'e'
/tmp/ccaF9kYf.o: In function `time_aes':
openssl-arm-aes.c:(.text+0x1cc): undefined reference to
`EVP_CIPHER_CTX_init'
openssl-arm-aes.c:(.text+0x1e4): undefined reference to `EVP_aes_128_cbc'
openssl-arm-aes.c:(.text+0x218): undefined reference to `EVP_EncryptInit_ex'
openssl-arm-aes.c:(.text+0x264): undefined reference to `EVP_EncryptUpdate'
openssl-arm-aes.c:(.text+0x29c): undefined reference to `EVP_EncryptFinal'
openssl-arm-aes.c:(.text+0x320): undefined reference to
`EVP_CIPHER_CTX_cleanup'
openssl-arm-aes.c:(.text+0x39c): undefined reference to `EVP_aes_128_cbc'
openssl-arm-aes.c:(.text+0x3c0): undefined reference to `EVP_DecryptInit'
openssl-arm-aes.c:(.text+0x40c): undefined reference to `EVP_DecryptUpdate'
openssl-arm-aes.c:(.text+0x440): undefined reference to `EVP_DecryptFinal'
collect2: ld returned 1 exit status

Looks like I am missing something really silly. Any suggestion?

Haven't tried Android NDK yet. May be its time !!

On Thu, Jun 16, 2011 at 6:23 PM, Mike Mohr akih...@gmail.com wrote:

 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




-- 
Regards
Nahid


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: 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