Skip to main content

Common procedures

Use these procedures when building any NanoSSH client example code or integrated application.

Note

Steps differ between NanoSSH Standard Edition (commercial) and Community Edition (open-source). Follow the steps for the edition you are using.

Add TrustCore SDK code to your development environment

The first step to building TrustCore SDK code is to add it to the application’s development environment.

Build NanoSSH client executable

Initialize TrustCore SDK code

Applications should perform the common TrustCore SDK initialization and shutdown work, as shown in the src/examples/mocana_example.c sample module.

In particular, make the following function calls and perform the following procedures:

Table 3. TrustCore SDK function call procedures and purposes

Phase

Function

Purpose

Startup

MOCANA_initMocana()

Initialize common runtime (logging, RNG, memory pools).

MOCANA_initLog(cb)

(Optional) Register a logging callback.

Start component server threads (for example, NanoSec IKE).

Implement a status-checking loop that runs and sleeps as long as an application running flag is true.

Shutdown

MOCANA_freeMocana()

Release all resources allocated during startup.