Correct some #ifdef mistakes in OpenSSL code

Some features can be disabled in OpenSSL easily by creating a #define to
disable it, but apparently there isn't enough testing for disabling
engines and OCSP.
Remove unused engines from OpenSSL crypto subdir

Part of the README.android directs you to remove the "engine" directory,
but misses the engine subdirectory of "crypto"  This adds a flag to
remove the unused engine functions altogether.

This change saves about 17344 bytes from the final build of libcrypto.so
in Thumb mode.
Remove Elliptic Curve crypto from OpenSSL

Nothing in Android appears to be using the elliptic curve cryptography
functions. There are some spec classes in libcore's jaa.security.spec,
but nothing that actually uses OpenSSL to implement it.

Removing this part from OpenSSL saves approximately 84116 bytes.
Remove OCSP from the OpenSSL build

OCSP is a good idea, but BouncyCastle implements its own OCSP. Nothing
in Android appears to use OpenSSL's OCSP implementation.

Removing OCSP saves about 22508 bytes from libcrypto.so
Revert "Remove unused engines from OpenSSL crypto subdir"

This reverts commit 6b515fe04b3ccea25fb2f1e686b2185880952a59.

Conflicts:

	android-config.mk
	crypto/Android.mk
Revert "Revert "Remove unused engines from OpenSSL crypto subdir""

This reverts commit e34c52b38bd2ef23d439758389767f87afda715c.

This is dependent on change Ic105b22aebec6a7af8656e60c79fe518d1dfa849
being applied to the external/ipsec-tools directory to remove dependency
on OpenSSL engine code.

Change-Id: Idf74c29c0dd265afac1563c8a6cdfbea36a91aa8
Upgrade to openssl-0.9.8k.
The source tree (and the size of the compiled library)
can be reduced further.  This will be done in a future
commit.
Add small_records.patch and handshake_cutthrough.patch.
See patches/README for additional details.
Modify handshake_patch such that app data is sent along with CCS/Finished.
Compile openssl for simulator builds with -DPURIFY for valgrind's benefit.

See: http://www.openssl.org/support/faq.html#PROG14
Enable zlib support in libcrypto.

Bug: 2361399
am 2f20ddcd: reconcile main tree with open-source eclair

Merge commit '2f20ddcd773aed226a1a57b8c46155451e5eb994' into eclair-plus-aosp

* commit '2f20ddcd773aed226a1a57b8c46155451e5eb994':
  android-2.1_r1 snapshot
am 66cd8ef3: am 2f20ddcd: reconcile main tree with open-source eclair

Merge commit '66cd8ef3b0a00c9d14572e5537b9fe235d5225b9'

* commit '66cd8ef3b0a00c9d14572e5537b9fe235d5225b9':
  android-2.1_r1 snapshot
Added lock support in libcrypto.

Libjingle (gchat) is multithreaded and uses openssl.
It needs the crypto lock support (openssl seems to be configured with
threads support: opensslconf.h defines OPENSSL_THREADS)

Bug:2423044
Add an empty CleanSpec.mk

Change-Id: I2ea58becd59740f16a18e9f7d72476c8bef01321
Summary: upgrading to openssl-0.9.8m and adding new testssl.sh

Testing Summary:
- Passed new android.testssl/testssl.sh
- General testing with BrowserActivity based program

Details:

Expanded detail in README.android about how to build and test openssl
upgrades based on my first experience.

	modified:   README.android

    Significant rework of import_openssl.sh script that does most of
    the work of the upgrade. Most of the existing code became the main
    and import functions. The newly regenerate code helps regenerate
    patch files, building on the fact that import now keeps and
    original unmodified read-only source tree for use for patch
    generation. Patch generation relies on additions to openssl.config
    for defining which patches include which files. Note that
    sometimes a file may be patched multiple times, in that case
    manual review is still necessary to prune the patch after
    auto-regeneration. Other enhancements to import_openssl.sh include
    generating android.testssl and printing Makefile defines for
    android-config.mk review.

	modified:   import_openssl.sh

Test support files for openssl/

   Add support for building /system/bin/ssltest as test executible for
   use by testssl script. Need confirmation that this is the right way
   to define such a test binary.

	modified:   patches/ssl_Android.mk

    Driver script that generates user and CA keys and certs on the
    device with /system/bin/openssl before running testssl. Based on
    openssl/test/testss for generation and openssl/test/Makefile
    test_ssl for test execution.

	new file:   patches/testssl.sh

  Note all following android.testssl files are automatically
  imported from openssl, although possible with modifications by
  import_openssl.sh

    testssl script imported from openssl/test that does the bulk of
    the testing. Includes new tests patched in for our additions.

	new file:   android.testssl/testssl

    CA and user certificate configuration files from openssl.
    Automatically imported from openssl/test/

 	new file:   android.testssl/CAss.cnf
	new file:   android.testssl/Uss.cnf

    certificate and key test file imported from openssl/apps

	new file:   android.testssl/server2.pem

Actual 0.9.8m upgrade specific bits

    Trying to bring ngm's small records support into 0.9.8m. Needs
    signoff by ngm although it does pass testing.

	modified:   patches/small_records.patch

    Update openssl.config for 0.9.8m. Expanded lists of undeeded
    directories and files for easier update and review, adding new
    excludes. Also added new definitions to support "import_openssl.sh
    regenerate" for patch updating.

	modified:   openssl.config

    Updated OPENSSL_VERSION to 0.9.8m

	modified:   openssl.version

    Automatically imported/patched files. Seems like it could be
    further pruned in by openssl.config UNNEEDED_SOURCES, but extra
    stuff doesn't end up impacting device.

	modified:   apps/...
	modified:   crypto/...
	modified:   include/...
	modified:   ssl/...

Other Android build stuff.

   Note for these patches/... is source, .../Android.mk is derived.

    Split LOCAL_CFLAGS additions into lines based on openssl/Makefile
    source for easier comparison when upgrading. I knowingly left the
    lines long and unwrapped for easy vdiff with openssl/Makefile

	modified:   android-config.mk

    Removed local -DOPENSSL_NO_ECDH already in android-config.mk.

	modified:   patches/apps_Android.mk

    Sync up with changes that had crept into derived crypto/Android.mk

	modified:   patches/crypto_Android.mk

Change-Id: I73204c56cdaccfc45d03a9c8088a6a93003d7ce6
Merge "Summary: upgrading to openssl-0.9.8m and adding new testssl.sh"
b/2453395 cannot reach sslvpn.broadcom.com

Disabled handshake_cutthrough.patch in openssl.config

Change-Id: I4fe837876198dcf0593c5f5d32174d8af76f3f9f
b/2522132 Native crash in sslRead()

Summary:
- the small_records.patch finished code review today, importing final version
- the native crash reflected an underling openssl issue, so we have a new patch for this

Details:

    Adding new patch for b/2522132 crash
	patches/bad_version.patch

    Syncing small_records.patch with reviewed version
	patches/small_records.patch

    Adding new patch to the list of active patches
	openssl.config

    Adding description of the new bad_version.patch
	patches/README

    Minor test script changes
    - Added adb remount
    - Simplified /mnt/sdcard to /sdcard
	patches/testssl.sh

    Added trace message as each patch is applied so I could more
    easily confirm that the newly added bad_version.patch was applied.
	import_openssl.sh

    Automatically generated files:
	android.testssl/testssl.sh
	ssl/d1_pkt.c
	ssl/s3_both.c
	ssl/s3_pkt.c

Change-Id: I1ca1b69d612ef425203074c58c031d6a681b92fe
Syncing with upstream openssl-0.9.8m patch to remove comment

Change-Id: Ic955c9252a7a8e20d5be4744802c9940f985fd9f