blob: a7c3cc10a4659a3d611161000a03acdf59a9c4ed [file] [log] [blame]
Nagendra Modadugue45f1062009-09-30 11:36:48 -07001OpenSSL on the Android platform.
The Android Open Source Project656d9c72009-03-03 19:30:25 -08002---
3
Nagendra Modadugue45f1062009-09-30 11:36:48 -07004The code in this directory is based on $OPENSSL_VERSION in the file
Brian Carlstrom8c67d9d2010-06-10 14:44:11 -07005openssl.version. See patches/README for more information on how the
6code differs from $OPENSSL_VERSION.
The Android Open Source Project656d9c72009-03-03 19:30:25 -08007
Nagendra Modadugue45f1062009-09-30 11:36:48 -07008Porting New Versions of OpenSSL.
9--
The Android Open Source Project656d9c72009-03-03 19:30:25 -080010
11The following steps are recommended for porting new OpenSSL versions.
12
Nagendra Modadugue45f1062009-09-30 11:36:48 -0700131) Retrieve the appropriate version of the OpenSSL source from
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080014 www.openssl.org/source (in openssl-*.tar.gz file). Check the PGP
15 signature (found in matching openssl-*.tar.gz.asc file) with:
The Android Open Source Project656d9c72009-03-03 19:30:25 -080016
Brian Carlstrom3d3a1b82010-08-18 11:26:06 -070017 gpg openssl-*.tar.gz.asc
The Android Open Source Project656d9c72009-03-03 19:30:25 -080018
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080019 If the public key is not found, import the the one with the
20 matching RSA key ID from http://www.openssl.org/about/, using:
21
22 gpg --import # paste PGP public key block on stdin
23
242) Update the variables in openssl.config and openssl.version as appropriate.
25 At the very least you will need to update the openssl.version.
26
273) Run:
28
29 ./import_openssl.sh import openssl-*.tar.gz
Nagendra Modadugue45f1062009-09-30 11:36:48 -070030
314) If there are any errors, then modify openssl.config, openssl.version
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080032 and patches in patches/ as appropriate. You might want to use:
Nagendra Modadugue45f1062009-09-30 11:36:48 -070033
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080034 ./import_openssl.sh regenerate patches/*.patch
35
36 Repeat step 3.
37
385) Cleanup before building with:
39
Brian Carlstromad880032010-05-14 11:42:48 -070040 m -j16 clean-libcrypto clean-libssl clean-openssl clean-ssltest
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080041
426) Build openssl from the external/openssl directory with:
43
Brian Carlstrom976a0342010-12-03 16:11:54 -080044 mm -j16 snod && adb remount && adb sync system
Nagendra Modadugue45f1062009-09-30 11:36:48 -070045
46 If there are build errors, then patches/*.mk, openssl.config, or
47 android-config.mk may need updating.
The Android Open Source Project656d9c72009-03-03 19:30:25 -080048
Brian Carlstrom98d58bb2010-03-09 09:56:55 -0800497) Run tests to make sure things are working:
50
Brian Carlstrom6e420382010-06-15 20:32:09 -070051 # Run local openssl tests
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080052 (cd android.testssl/ && ./testssl.sh)
Brian Carlstrom6e420382010-06-15 20:32:09 -070053 # Build and sync libcore tests
54 (croot && cd libcore && mm -j16 snod && adb remount && adb sync)
Brian Carlstrom04945242010-06-16 11:03:59 -070055 # Run tests from libcore
David 'Digit' Turner063cfe12013-02-19 17:08:14 +010056 (croot && vogar --classpath out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar javax.net.ssl tests.api.javax.net)
Brian Carlstrom04945242010-06-16 11:03:59 -070057 # Run tests from Harmony
David 'Digit' Turner063cfe12013-02-19 17:08:14 +010058 (croot && vogar --classpath out/target/common/obj/JAVA_LIBRARIES/apache-harmony-tests_intermediates/classes.jar tests.api.java.math.BigIntegerTest org.apache.harmony.tests.java.math)
Brian Carlstrom6e420382010-06-15 20:32:09 -070059 # try an https website
Brian Carlstrom925e1a42010-04-26 11:13:10 -070060 adb shell am start https://online.citibank.com # confirm result in browser
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080061
Brian Carlstrom04945242010-06-16 11:03:59 -070062 The vogar tool can be found externally at http://code.google.com/p/vogar/
Brian Carlstrom04945242010-06-16 11:03:59 -070063
David 'Digit' Turner063cfe12013-02-19 17:08:14 +010064 Quick installation instructions (without rebuilding from source):
65 VOGAR=$HOME/vogar
66 svn co http://vogar.googlecode.com/svn/trunk/ $VOGAR
67 mkdir -p $VOGAR/build/
68 curl -o $VOGAR/build/vogar.jar https://vogar.googlecode.com/files/vogar.jar
69 PATH=$PATH:$VOGAR/bin
70
71 Within Google, you can find it under:
72 /home/dalvik-prebuild/vogar/bin/vogar
Brian Carlstrom04945242010-06-16 11:03:59 -070073
Brian Carlstrom4e0e02a2010-07-16 11:09:17 -070074 # You can also run openssl s_server as a test server on the device:
75 adb push ./android.testssl/CAss.cnf /sdcard/CAss.cnf
76 adb shell openssl req -config /sdcard/CAss.cnf -x509 -nodes -days 365 -subj '/C=US/ST=California/L=Mountain View/CN=localhost' -newkey rsa:1024 -keyout /sdcard/server.pem -out /sdcard/server.pem
77 adb shell openssl s_server -cert /sdcard/server.pem -www -verify 1
78 adb shell am start https://localhost:4433 # confirm result in browser
79
Brian Carlstrom98d58bb2010-03-09 09:56:55 -0800808) Do a full build before checking in:
81
Brian Carlstrom8c67d9d2010-06-10 14:44:11 -070082 m -j16
The Android Open Source Project656d9c72009-03-03 19:30:25 -080083
David 'Digit' Turner9fbf99a2013-02-19 10:38:34 +010084Optionally, check whether build flags (located in CONFIGURE_ARGS in
85openssl.config, plus some extras in android-config.mk), need to be updated.
86Doing this step will help ensure that the compiled library is appropriately
87optimized for speed and size.