Skip to content

Commit

Permalink
Merge pull request #73 from cconlon/releasePrep
Browse files Browse the repository at this point in the history
Release prep and fixes for 1.8.0
  • Loading branch information
JacobBarthelmeh authored Nov 12, 2021
2 parents 7f89200 + a4f1447 commit f71ed63
Show file tree
Hide file tree
Showing 25 changed files with 910 additions and 291 deletions.
6 changes: 6 additions & 0 deletions IDE/Android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions IDE/Android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions IDE/Android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion IDE/Android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions IDE/Android/.idea/runConfigurations.xml

This file was deleted.

90 changes: 79 additions & 11 deletions IDE/Android/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
This is an example of use with Android Studio.
# Android Studio Example Project

An emulation of Nexus 4 API 23 (Android 6.0, API 23) was used with testing and Android Studio IDE version 3.3.2 was used.
This is an example Android Studio project file for wolfssljni / wolfJSSE. This
project should be used for reference only.

Steps to run example:
Tool and version information used when testing this project:

1) On the Android device BKS format key stores are expected. To convert the JKS example bundles to BKS use the following commands:
- Ubuntu 20.04.3 LTS
- Android Studio Arctic Fox 2020.3.1 Patch 3
- Android Gradle Plugin Version: 4.2.2
- Gradle Version: 6.9.1
- API 28: Android 9.0 (Pie)
- Emulator: Nexus 5X API 28

The following sections outline steps required to run this example on an
Android device or emulator.

## Converting JKS to BKS for Android Use

On the Android device BKS format key stores are expected. To convert the
JKS example bundles to BKS use the following commands. Note: you will need
to download a version of the bcprov JAR from the Bouncy Castle website:

```
cd examples/provider
./convert-to-bks.sh <path/to/provider>
```

exmaple:
For exmaple, when using bcprov-ext-jdk15on-169.jar:

```
cd examples/provider
./convert-to-bks.sh ~/Downloads/bcprov-jdk15on-161.jar
./convert-to-bks.sh ~/Downloads/bcprov-ext-jdk15on-169.jar
```

2) Push BKS bundles up to the device along with certificates. To do this start up the emulator/device and use "adb push". An example of this would be the following commands from root wolfssljni directory:
## Push BKS to Android Device or Emulator

Push BKS bundles up to the device along with certificates. To do this start
up the emulator/device and use `adb push`. An example of this would be the
following commands from root wolfssljni directory:

```
adb shell
Expand All @@ -28,10 +50,56 @@ adb push ./examples/provider/*.bks /sdcard/examples/provider/
adb push ./examples/certs/ /sdcard/examples/
```

3) Add wolfssl source code for compiling. The project looks for the directory wolfssljni/IDE/Android/app/src/main/cpp/wolfssl for wolfSSL source code. This can be done multiple ways one being to download the latest release from wolfSSL's website, unzip it, rename it to wolfssl, and place it in the direcotry wolfssljni/IDE/Android/app/src/main/cpp/. Alternatively GitHub can be used with "cd /IDE/Android/app/src/main/cpp/ && git clone https://github.com/wolfssl/wolfssl". And the final method to be mentioned in this document is by creating a symbolic link to a wolfssl directory on the system by using "cd /IDE/Android/app/src/main/cpp/ && ln -s /path/to/local/wolfssl ./wolfssl".
## Add Native wolfSSL Library Source Code to Project

This example project is already set up to compile and build the native
wolfSSL library source files, but the wolfSSL files themselves have not been
included in this package. You must download or link an appropriate version
of wolfSSL to this project using one of the options below.

The project looks for the directory
`wolfssljni/IDE/Android/app/src/main/cpp/wolfssl` for wolfSSL source code.
This can added in multiple ways:

- OPTION A: Download the latest wolfSSL library release from www.wolfssl.com,
unzip it, rename it to `wolfssl`, and place it in the direcotry
`wolfssljni/IDE/Android/app/src/main/cpp/`.

```
$ unzip wolfssl-X.X.X.zip
$ mv wolfssl-X.X.X wolfssljni/IDE/Android/app/src/main/cpp/wolfssl
```

- OPTION B: Alternatively GitHub can be used to clone wolfSSL:

```
$ cd /IDE/Android/app/src/main/cpp/
$ git clone https://github.com/wolfssl/wolfssl
$ cp wolfssl/options.h.in wolfssl/options.h
```

- OPTION C: A symbolic link to a wolfssl directory on the system by using:

```
$ cd /IDE/Android/app/src/main/cpp/
$ ln -s /path/to/local/wolfssl ./wolfssl
```

## Importing and Building the Example Project with Android Studio

4) Open the Android Studio project by double clicking on the `Android` folder
in wolfssljni/IDE/

5) Build the project and run MainActivity from app -> java/com/example.wolfssl.
This will ask for permissions to access the certificates in the /sdcard/
directory and then print out the server certificate information on success.

6) OPTIONAL: The androidTests can be run after permissions has been given.
app->java->com.wolfssl->provider.jsse.test->WolfSSLJSSETestSuite and
app->java->com.wolfssl->test->WolfSSLTestSuite

4) Open the Android studio project by double clicking on the Android folder in wolfssljni/IDE/
## Support

5) Compile the project and run MainActivity from app -> java -> com -> example.wolfssl. This will ask for permissions to access the certificates in the /sdcard/ directory and then print out the server certificate information on success.
Please contact wolfSSL support at [email protected] with any questions or
feedback.

6) OPTIONAL : The androidTests can then be ran after permissions has been given. app->java->com.wolfssl->provider.jsse.test->WolfSSLJSSETestSuite and app->java->com.wolfssl->test->WolfSSLTestSuite
51 changes: 40 additions & 11 deletions IDE/Android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@
cmake_minimum_required(VERSION 3.4.1)

# Add preprocessor defines to CFLAGS
add_definitions(-DWOLFSSL_JNI -DWOLFSSL_DTLS -DOPENSSL_EXTRA -DHAVE_CRL -DHAVE_CRL_MONITOR
-DHAVE_OCSP -DPERSIST_SESSION_CACHE -DPERSIST_CERT_CACHE -DATOMIC_USER
-DHAVE_ECC -DTFM_ECC256 -DHAVE_PK_CALLBACKS -DHAVE_DH -DUSE_FAST_MATH
-DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT -DWC_RSA_BLINDING -DTFM_NO_ASM
-DWOLFSSL_USER_IO -DWOLFSSL_CERT_EXT -DWOLFSSL_CERT_GEN
)
add_definitions(-DHAVE_FFDHE_2048 -DWOLFSSL_TLS13 -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES
-DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT -DWC_RSA_BLINDING -DHAVE_AESGCM
-DWOLFSSL_SHA512 -DWOLFSSL_SHA384 -DHAVE_HKDF -DNO_DSA -DHAVE_ECC -DTFM_ECC256
-DECC_SHAMIR -DWC_RSA_PSS -DWOLFSSL_BASE64_ENCODE -DNO_RC4 -DNO_HC128 -DNO_RABBIT
-DWOLFSSL_SHA224 -DWOLFSSL_SHA3 -DHAVE_POLY1305 -DHAVE_ONE_TIME_AUTH -DHAVE_CHACHA
-DHAVE_HASHDRBG -DHAVE_TLS_EXTENSIONS -DHAVE_SUPPORTED_CURVES -DHAVE_EXTENDED_MASTER
-DHAVE_SNI -DHAVE_ALPN -DWOLFSSL_JNI -DWOLFSSL_DTLS -DOPENSSL_EXTRA -DOPENSSL_ALL
-DHAVE_EX_DATA -DHAVE_CRL -DHAVE_OCSP -DHAVE_CRL_MONITOR -DPERSIST_SESSION_CACHE
-DPERSIST_CERT_CACHE -DATOMIC_USER -DHAVE_PK_CALLBACKS -DWOLFSSL_CERT_EXT -DWOLFSSL_CERT_GEN
-DHAVE_ENCRYPT_THEN_MAC -DNO_MD4 -DWOLFSSL_ENCRYPTED_KEYS -DUSE_FAST_MATH -DNO_DES3
-DKEEP_PEER_CERT -DSESSION_CERTS -DHAVE_SESSION_TICKET -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8
-DTFM_NO_ASM)

# set wolfSSL JNI location as environment variable, change if needed
set(wolfssljni_DIR ${CMAKE_SOURCE_DIR}/../../../../../../)
Expand All @@ -31,30 +37,38 @@ add_library(wolfssl SHARED
${wolfssl_DIR}/wolfcrypt/src/asm.c
${wolfssl_DIR}/wolfcrypt/src/asn.c
${wolfssl_DIR}/wolfcrypt/src/blake2b.c
${wolfssl_DIR}/wolfcrypt/src/blake2s.c
${wolfssl_DIR}/wolfcrypt/src/camellia.c
${wolfssl_DIR}/wolfcrypt/src/chacha.c
${wolfssl_DIR}/wolfcrypt/src/chacha20_poly1305.c
${wolfssl_DIR}/wolfcrypt/src/cmac.c
${wolfssl_DIR}/wolfcrypt/src/coding.c
${wolfssl_DIR}/wolfcrypt/src/compress.c
${wolfssl_DIR}/wolfcrypt/src/cpuid.c
${wolfssl_DIR}/wolfcrypt/src/cryptocb.c
${wolfssl_DIR}/wolfcrypt/src/curve25519.c
${wolfssl_DIR}/wolfcrypt/src/curve448.c
${wolfssl_DIR}/wolfcrypt/src/des3.c
${wolfssl_DIR}/wolfcrypt/src/dh.c
${wolfssl_DIR}/wolfcrypt/src/dsa.c
${wolfssl_DIR}/wolfcrypt/src/ecc.c
${wolfssl_DIR}/wolfcrypt/src/ecc_fp.c
${wolfssl_DIR}/wolfcrypt/src/eccsi.c
${wolfssl_DIR}/wolfcrypt/src/ed25519.c
${wolfssl_DIR}/wolfcrypt/src/ed448.c
${wolfssl_DIR}/wolfcrypt/src/error.c
${wolfssl_DIR}/wolfcrypt/src/fe_448.c
${wolfssl_DIR}/wolfcrypt/src/fe_low_mem.c
${wolfssl_DIR}/wolfcrypt/src/fe_operations.c
${wolfssl_DIR}/wolfcrypt/src/ge_448.c
${wolfssl_DIR}/wolfcrypt/src/ge_low_mem.c
${wolfssl_DIR}/wolfcrypt/src/ge_operations.c
${wolfssl_DIR}/wolfcrypt/src/hash.c
${wolfssl_DIR}/wolfcrypt/src/hc128.c
${wolfssl_DIR}/wolfcrypt/src/hmac.c
${wolfssl_DIR}/wolfcrypt/src/idea.c
${wolfssl_DIR}/wolfcrypt/src/integer.c
${wolfssl_DIR}/wolfcrypt/src/kdf.c
${wolfssl_DIR}/wolfcrypt/src/logging.c
${wolfssl_DIR}/wolfcrypt/src/md2.c
${wolfssl_DIR}/wolfcrypt/src/md4.c
Expand All @@ -66,28 +80,41 @@ add_library(wolfssl SHARED
${wolfssl_DIR}/wolfcrypt/src/pwdbased.c
${wolfssl_DIR}/wolfcrypt/src/rabbit.c
${wolfssl_DIR}/wolfcrypt/src/random.c
${wolfssl_DIR}/wolfcrypt/src/rc2.c
${wolfssl_DIR}/wolfcrypt/src/ripemd.c
${wolfssl_DIR}/wolfcrypt/src/rsa.c
${wolfssl_DIR}/wolfcrypt/src/sha.c
${wolfssl_DIR}/wolfcrypt/src/sakke.c
${wolfssl_DIR}/wolfcrypt/src/sha256.c
${wolfssl_DIR}/wolfcrypt/src/sha3.c
${wolfssl_DIR}/wolfcrypt/src/sha512.c
${wolfssl_DIR}/wolfcrypt/src/sha.c
${wolfssl_DIR}/wolfcrypt/src/signature.c
${wolfssl_DIR}/wolfcrypt/src/sp_arm32.c
${wolfssl_DIR}/wolfcrypt/src/sp_arm64.c
${wolfssl_DIR}/wolfcrypt/src/sp_armthumb.c
${wolfssl_DIR}/wolfcrypt/src/sp_c32.c
${wolfssl_DIR}/wolfcrypt/src/sp_c64.c
${wolfssl_DIR}/wolfcrypt/src/sp_cortexm.c
${wolfssl_DIR}/wolfcrypt/src/sp_dsp32.c
${wolfssl_DIR}/wolfcrypt/src/sp_int.c
${wolfssl_DIR}/wolfcrypt/src/sp_x86_64.c
${wolfssl_DIR}/wolfcrypt/src/srp.c
${wolfssl_DIR}/wolfcrypt/src/tfm.c
${wolfssl_DIR}/wolfcrypt/src/wc_dsp.c
${wolfssl_DIR}/wolfcrypt/src/wc_encrypt.c
${wolfssl_DIR}/wolfcrypt/src/wc_pkcs11.c
${wolfssl_DIR}/wolfcrypt/src/wc_port.c
${wolfssl_DIR}/wolfcrypt/src/wolfevent.c
${wolfssl_DIR}/wolfcrypt/src/wolfmath.c
${wolfssl_DIR}/src/crl.c
${wolfssl_DIR}/src/internal.c
${wolfssl_DIR}/src/wolfio.c
${wolfssl_DIR}/src/keys.c
${wolfssl_DIR}/src/ocsp.c
${wolfssl_DIR}/src/sniffer.c
${wolfssl_DIR}/src/ssl.c
${wolfssl_DIR}/src/tls.c
${wolfssl_DIR}/src/tls13.c
${wolfssl_DIR}/src/tls.c
${wolfssl_DIR}/src/wolfio.c
)

# set_target_properties(wolfssl PROPERTIES LIBRARY_OUTPUT_DIRECTORY
Expand All @@ -97,12 +124,14 @@ add_library(wolfssl SHARED
# wolfSSL JNI Java files are tied into build in Module build.gradle file
add_library(wolfssljni SHARED
${wolfssljni_DIR}/native/com_wolfssl_wolfcrypt_ECC.c
${wolfssljni_DIR}/native/com_wolfssl_wolfcrypt_EccKey.c
${wolfssljni_DIR}/native/com_wolfssl_wolfcrypt_RSA.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSL.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLContext.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLSession.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLCertificate.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLCertManager.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLContext.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLSession.c
${wolfssljni_DIR}/native/com_wolfssl_WolfSSLX509StoreCtx.c
)

# set_target_properties(wolfssljni PROPERTIES LIBRARY_OUTPUT_DIRECTORY
Expand Down
2 changes: 1 addition & 1 deletion IDE/Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:4.2.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 3 additions & 3 deletions IDE/Android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Apr 11 15:51:35 MDT 2019
#Thu Nov 04 15:51:08 MDT 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
zipStoreBase=GRADLE_USER_HOME
Loading

0 comments on commit f71ed63

Please sign in to comment.