blob: 62456bfbf3cb4d1a4d9e6a4b0ec4822e7cb043d5 [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
56 (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)
57 # Run tests from Harmony
58 (croot && vogar --classpath harmony_tests.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/
63 Within Google it can be run with ~dalvik-prebuild/vogar/bin/vogar
64
65 harmony_tests.jar is built from Subversion http://harmony.apache.org/
66 Within Google it can be found at ~dalvik-prebuild/bin/harmony_tests.jar
67
Brian Carlstrom4e0e02a2010-07-16 11:09:17 -070068 # You can also run openssl s_server as a test server on the device:
69 adb push ./android.testssl/CAss.cnf /sdcard/CAss.cnf
70 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
71 adb shell openssl s_server -cert /sdcard/server.pem -www -verify 1
72 adb shell am start https://localhost:4433 # confirm result in browser
73
Brian Carlstrom98d58bb2010-03-09 09:56:55 -0800748) Do a full build before checking in:
75
Brian Carlstrom8c67d9d2010-06-10 14:44:11 -070076 m -j16
The Android Open Source Project656d9c72009-03-03 19:30:25 -080077
David 'Digit' Turner9fbf99a2013-02-19 10:38:34 +010078Optionally, check whether build flags (located in CONFIGURE_ARGS in
79openssl.config, plus some extras in android-config.mk), need to be updated.
80Doing this step will help ensure that the compiled library is appropriately
81optimized for speed and size.