blob: 7a922c9856e6f19e154944a90e9cc1063e1021ed [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
5openssl.config, and some backported OpenSSL code in crypto/0.9.9-dev.
Brian Carlstromf2ee5ff2010-03-30 09:41:16 -07006See patches/README for more information on how the code differs from
7$OPENSSL_VERSION.
The Android Open Source Project656d9c72009-03-03 19:30:25 -08008
Nagendra Modadugue45f1062009-09-30 11:36:48 -07009Porting New Versions of OpenSSL.
10--
The Android Open Source Project656d9c72009-03-03 19:30:25 -080011
12The following steps are recommended for porting new OpenSSL versions.
13
Nagendra Modadugue45f1062009-09-30 11:36:48 -0700141) Retrieve the appropriate version of the OpenSSL source from
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080015 www.openssl.org/source (in openssl-*.tar.gz file). Check the PGP
16 signature (found in matching openssl-*.tar.gz.asc file) with:
The Android Open Source Project656d9c72009-03-03 19:30:25 -080017
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080018 gpg openssl-*.tar.gz
The Android Open Source Project656d9c72009-03-03 19:30:25 -080019
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080020 If the public key is not found, import the the one with the
21 matching RSA key ID from http://www.openssl.org/about/, using:
22
23 gpg --import # paste PGP public key block on stdin
24
252) Update the variables in openssl.config and openssl.version as appropriate.
26 At the very least you will need to update the openssl.version.
27
283) Run:
29
30 ./import_openssl.sh import openssl-*.tar.gz
Nagendra Modadugue45f1062009-09-30 11:36:48 -070031
324) If there are any errors, then modify openssl.config, openssl.version
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080033 and patches in patches/ as appropriate. You might want to use:
Nagendra Modadugue45f1062009-09-30 11:36:48 -070034
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080035 ./import_openssl.sh regenerate patches/*.patch
36
37 Repeat step 3.
38
395) Cleanup before building with:
40
Brian Carlstromad880032010-05-14 11:42:48 -070041 m -j16 clean-libcrypto clean-libssl clean-openssl clean-ssltest
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080042
436) Build openssl from the external/openssl directory with:
44
Brian Carlstromad880032010-05-14 11:42:48 -070045 mm -j16 snod && adb sync system
Nagendra Modadugue45f1062009-09-30 11:36:48 -070046
47 If there are build errors, then patches/*.mk, openssl.config, or
48 android-config.mk may need updating.
The Android Open Source Project656d9c72009-03-03 19:30:25 -080049
Brian Carlstrom98d58bb2010-03-09 09:56:55 -0800507) Run tests to make sure things are working:
51
Brian Carlstrom6e420382010-06-15 20:32:09 -070052 # Run local openssl tests
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080053 (cd android.testssl/ && ./testssl.sh)
Brian Carlstrom6e420382010-06-15 20:32:09 -070054 # Build and sync libcore tests
55 (croot && cd libcore && mm -j16 snod && adb remount && adb sync)
Brian Carlstrom04945242010-06-16 11:03:59 -070056 # Run tests from libcore
57 (croot && vogar --classpath out/target/common/obj/JAVA_LIBRARIES/core-tests-support_intermediates/classes.jar --classpath out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/classes.jar javax.net.ssl tests.api.javax.net)
58 # Run tests from Harmony
59 (croot && vogar --classpath harmony_tests.jar tests.api.java.math.BigIntegerTest org.apache.harmony.tests.java.math)
Brian Carlstrom6e420382010-06-15 20:32:09 -070060 # try an https website
Brian Carlstrom925e1a42010-04-26 11:13:10 -070061 adb shell am start https://online.citibank.com # confirm result in browser
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080062
Brian Carlstrom04945242010-06-16 11:03:59 -070063 The vogar tool can be found externally at http://code.google.com/p/vogar/
64 Within Google it can be run with ~dalvik-prebuild/vogar/bin/vogar
65
66 harmony_tests.jar is built from Subversion http://harmony.apache.org/
67 Within Google it can be found at ~dalvik-prebuild/bin/harmony_tests.jar
68
Brian Carlstrom98d58bb2010-03-09 09:56:55 -0800698) Do a full build before checking in:
70
71 m clobber && m -j16
The Android Open Source Project656d9c72009-03-03 19:30:25 -080072
Nagendra Modadugue45f1062009-09-30 11:36:48 -070073Optionally, check whether build flags (located in android-config.mk
74need to be updated. Doing this step will help ensure that the
75compiled library is appropriately optimized for speed and size. To
76update build flags:
The Android Open Source Project656d9c72009-03-03 19:30:25 -080077
Nagendra Modadugue45f1062009-09-30 11:36:48 -070078a) source openssl.config
79b) tar -zxf openssl-*.tar.gz
80c) cd openssl-*/
81d) ./Configure $CONFIGURE_ARGS
82e) examine Makefile and compare with ../android-config.mk
83f) modify ../openssl.config as appropriate and go to step 3) above.
The Android Open Source Project656d9c72009-03-03 19:30:25 -080084
Brian Carlstrom98d58bb2010-03-09 09:56:55 -080085Alternatively, ."/import_openssl.sh import" now prints the
86post-Configure Makefile for review before deleting in on import.