Home

Awesome

SharkSSL

SharkSSL Amalgamated

SharkSSL Amalgamated is a compact version of SharkSSL extracted from the SharkSSL SDK. This amalgamated version of SharkSSL is intended for evaluation purposes. For full license details, please see below. SharkSSL Amalgamated includes all APIs found in the standard SharkSSL SDK. SharkSSL Amalgamated includes the following source code components.

Only SharkSSL.c and TargConfig.h are required if you are directly using the transport agnostic SharkSSL API. A SharkSSL Library can be created as follows:

$ gcc -c src/SharkSSL.c -Iinc -Iinc/arch/Posix
$ ar -rc libsharkssl.a SharkSSL.o

Note that SharkSSL can be compiled using any C (cross) compiler. SharkSSL is C89 compatible.

SharkSSL Amalgamated Limitations

SharkSSL Amalgamated does not include assembler optimized ciphers.

Memory

SharkSSL is very efficient at using memory and a secure IoT client connection can use less than 10K total. SharkSSL manages memory by using a memory allocator. You can use any allocator, including the very efficient allocator found in the examples/malloc directory. Some of the porting layers are pre-set to use this allocator. You can change the allocator by modifying the macros in inc/arch/XXX/TargConfig.h

IoT Protocols

The following IoT protocols are included with SharkSSL Amalgamated. Note that all protocols require selib.c and all protocols use TLS.

To compile SharkSSL and one of the IoT protocols, include SharkSSL.c, the required protocol, src/arch/XXX/*.c if included, where XXX is the required porting layer. In addition, the compiler's include path must include inc, inc/arch/XXX, and src/arch/XXX.

Examples

The following lists the IoT examples included with SharkSSL Amalgamated. The examples directory includes additional examples. See the online SharkSSL example documentation for additional details on the examples.

All examples below use TLS. We recommend reading the article Certificate Management for Embedded Systems if you are new to PKI and X.509 certificate management.

Testing the Examples

The SharkSSL TLS stack and the included protocol stacks are mainly designed for embedded devices but can also be compiled for Windows and Linux. Below is an example demonstrating how to compile and run two examples on Linux and the Windows Subsystem for Linux (WSL).

Start by installing the required tools and cloning the repository:

sudo apt install git gcc
git clone https://github.com/RealTimeLogic/SharkSSL
cd SharkSSL/

How to compile the MQTT Chat Example:

# Compile SharkSSL, SharkMQTT, the socket lib, and the chat example
gcc -o Chat-MQTT -Iinc -Iinc/arch/Posix -Isrc/arch/Posix \
    src/SharkSSL.c src/SharkMQTT.c src/selib.c examples/Chat-MQTT.c
# Start the MQTT chat example
./Chat-MQTT

How to compile the SMQ LED Example:

# Compile SharkSSL, SharkMQ (secure SMQ), the socket lib, and the chat example
gcc -o LED-SMQ -Iinc -Iinc/arch/Posix -Isrc/arch/Posix \
    src/SharkSSL.c src/SharkMQ.c src/selib.c examples/LED-SMQ.c
# Start the example
./LED-SMQ

Makefile

A basic makefile for Linux is included. The makefile shows how to build the SharkSSL command line tools and most of the examples. The command line tools can also be compiled for Windows. Note that the examples requiring configuration will not work when compiled without modifications. The SMTP-example.c produces a compile error when not configured.

SharkSSL IDE

For FreeRTOS users: check out the super easy to use SharkSSL IDE designed for educational purposes.

License

SharkSSL Amalgamated is either licensed for use under the GPLv2 or a standard commercial license. For our users who cannot use SharkSSL Amalgamated under GPLv2, a commercial license is available. A free commercial license for small companies is available. See the startup license page for details: https://realtimelogic.com/startuplic/