|
| 1 | +# wolfSSL with Analog Devices MAXQ10xx |
| 2 | + |
| 3 | +This example implements a very simple client application that uses the Analog |
| 4 | +Devices MAXQ1065 or MAXQ1080 to do cryptographic operations. Please see the |
| 5 | +product documentation for what operations are supported. |
| 6 | + |
| 7 | +NOTE: These instructions are for a MAXQ1065 or MAXQ1080 evaluation board plugged |
| 8 | + into the 40-pin GPIO headers of a RaspberryPi. The SDK and example |
| 9 | + application are built and executed on the RaspberryPi. |
| 10 | + |
| 11 | +## Building and Installing wolfSSL |
| 12 | + |
| 13 | +You need to have wolfSSL built via the MAXQ10xx SDK. Please contact Analog |
| 14 | +Devices to request the SDK. Make sure you have all the required hardware and |
| 15 | +software. Follow the instructions to build the SDK. Once completed, there will |
| 16 | +be two instances of wolfSSL in the SDK directory; one for server operations |
| 17 | +(`wolfssl`) and one for client operations (`maxq10xx-wolfssl`). The client |
| 18 | +instance's cryptographic operations are performed by the MAXQ1065 or MAXQ1080. |
| 19 | +Enter the `maxq10xx-wolfssl` and install the client instance: |
| 20 | + |
| 21 | +``` |
| 22 | +cd /path/to/maxq10xx-sdk/maxq10xx-wolfssl |
| 23 | +sudo make install |
| 24 | +sudo ldconfig |
| 25 | +``` |
| 26 | + |
| 27 | +This will put the appropriate header files and dynamic libraries in |
| 28 | +`/usr/local/include` and `/usr/local/lib/`. |
| 29 | + |
| 30 | +NOTE: Do NOT install the instance for server operations (`wolfssl`). |
| 31 | + |
| 32 | +## Setting Up the MAXQ1065 or MAXQ1080 |
| 33 | + |
| 34 | +Follow the SDK instructions for generating and loading the desired cryptographic |
| 35 | +artifacts into MAXQ1065 or MAXQ1080. This will depend on the TLS version and |
| 36 | +algorithms you want to use. |
| 37 | + |
| 38 | +## Dummy Keys |
| 39 | + |
| 40 | +The build of wolfSSL uses our pkcallbacks configuration to allow MAXQ1065 or |
| 41 | +MAXQ1080 to do the cryptographic operations. In order for wolfSSL to understand |
| 42 | +the algorithms being used, on the command line we substitute the private key |
| 43 | +with a dummy public key at runtime. You can generate these dummy public keys by |
| 44 | +running the following commands: |
| 45 | + |
| 46 | +``` |
| 47 | +openssl x509 -in <ecc_cert>.pem -pubkey -noout > ecc-p256-pub.pem |
| 48 | +openssl x509 -in <rsa_cert>.pem -pubkey -noout > rsa-2048-pub.pem |
| 49 | +``` |
| 50 | + |
| 51 | +`<ecc_cert>.pem` must be a certificate with an ECC P-256 public key in it. |
| 52 | +`<rsa_cert>.pem` must be a certificate with an RSA 2048-bit public key in it. |
| 53 | +For your convenience, they have already been provided. |
| 54 | + |
| 55 | +``` |
| 56 | +make maxq10xx-wolfssl-client |
| 57 | +``` |
| 58 | + |
| 59 | +## Running the Example |
| 60 | + |
| 61 | +The client and server are executed with different command-line parameters |
| 62 | +depending on the desired algorithms and TLS version. First, go into the correct |
| 63 | +locations in your shell: |
| 64 | + |
| 65 | +``` |
| 66 | +cd /path/to/maxq10xx-sdk/wolfssl |
| 67 | +``` |
| 68 | + |
| 69 | +``` |
| 70 | +cd /path/to/wolfssl-examples/maxq10xx |
| 71 | +``` |
| 72 | + |
| 73 | +Depending on which of the following algorithms and TLS versions, execute the |
| 74 | +associated commands as shown. |
| 75 | + |
| 76 | +### TLS 1.2 PSK (MAXQ1065 or MAXQ1080) |
| 77 | + |
| 78 | +``` |
| 79 | +./examples/server/server -s -v 3 -l PSK-AES128-CCM-8 |
| 80 | +``` |
| 81 | + |
| 82 | +``` |
| 83 | +./maxq10xx-wolfssl-client -tls12 -psk |
| 84 | +``` |
| 85 | + |
| 86 | +### TLS 1.2 ECC (MAXQ1065 or MAXQ1080) |
| 87 | + |
| 88 | +``` |
| 89 | +./examples/server/server -F -v 3 -l ECDHE-ECDSA-AES128-GCM-SHA256 \ |
| 90 | + -c ../pki/CA_secp256r1/cert_server_ECDSA_secp256r1_secp256r1.pem \ |
| 91 | + -k ../pki/CA_secp256r1/privkey_server_ECDSA_secp256r1_secp256r1.pem \ |
| 92 | + -A ../pki/CA_secp256r1/cert_CA.pem |
| 93 | +``` |
| 94 | + |
| 95 | +``` |
| 96 | +./maxq10xx-wolfssl-client -tls12 -ecc |
| 97 | +``` |
| 98 | + |
| 99 | +### TLS 1.3 PSK (Only MAXQ1080) |
| 100 | + |
| 101 | +``` |
| 102 | +./examples/server/server -v 4 -s -l TLS13-AES128-GCM-SHA256 |
| 103 | +``` |
| 104 | + |
| 105 | +``` |
| 106 | +./maxq10xx-wolfssl-client -tls13 -psk |
| 107 | +``` |
| 108 | + |
| 109 | +### TLS 1.3 ECC (Only MAXQ1080) |
| 110 | + |
| 111 | +``` |
| 112 | +./examples/server/server -F -v 4 -l TLS13-AES128-GCM-SHA256 \ |
| 113 | + -c ../pki/CA_secp256r1/cert_server_ECDSA_secp256r1_secp256r1.pem \ |
| 114 | + -k ../pki/CA_secp256r1/privkey_server_ECDSA_secp256r1_secp256r1.pem \ |
| 115 | + -A ../pki/CA_secp256r1/cert_CA.pem |
| 116 | +``` |
| 117 | + |
| 118 | +``` |
| 119 | +./maxq10xx-wolfssl-client -tls13 -ecc |
| 120 | +``` |
| 121 | + |
| 122 | +### TLS 1.3 RSA and FFDHE (Only MAXQ1080) |
| 123 | + |
| 124 | +``` |
| 125 | +./examples/server/server -F -v 4 -l TLS13-AES128-GCM-SHA256 \ |
| 126 | + -c ../pki/CA_RSA_2048/cert_server_RSA_2048_RSA_2048.pem \ |
| 127 | + -k ../pki/CA_RSA_2048/privkey_server_RSA_2048_RSA_2048.pem \ |
| 128 | + -A ../pki/CA_RSA_2048/cert_CA.pem |
| 129 | +``` |
| 130 | + |
| 131 | +``` |
| 132 | +./maxq10xx-wolfssl-client -tls13 -rsa |
| 133 | +``` |
| 134 | + |
| 135 | +### Expected Output |
| 136 | + |
| 137 | +The server will print very little status information about the algorithms and |
| 138 | +ciphersuite negotiated. It will wait for a message from the client. |
| 139 | + |
| 140 | +The client will give lots of debug and status logging. It will then prompt the |
| 141 | +user for a message. You should type in something like "Hello, this is MAXQ!" and |
| 142 | +press enter. |
| 143 | + |
| 144 | +The server will print out the message you typed, send the message "I hear you |
| 145 | +fa shizzle!" and then terminate. |
| 146 | + |
| 147 | +The client will print the message it received from the server along with more |
| 148 | +debug and status logging and then terminate. |
| 149 | + |
0 commit comments