Skip to content

struct ota_server_t

Represents an OTA (Over-The-Air) server. More...

#include <ota/ota.h>

Public Attributes

Name
ota_protocol_tprotocol
the protocol, the update should be downloaded with
char *hostname
the DNS hostname of the OTA server
uint16_tport
the TCP/UDP port number for the OTA download
char *filename
the OTA filename in case of OTA_PROTO_HTTP / OTA_PROTO_HTTPS
struct ota_server_tota_http_params
unsigned char *cert
unsigned intcert_len
< the x.509 certificate of the serer for OTA_PROTO_HTTPS / OTA_PROTO_TLS
uint8_t[32]pin_pubkey_sha256
< the len of the x.509 certificate
struct ota_server_tota_tls_params

Detailed Description

cpp
struct ota_server_t;

Represents an OTA (Over-The-Air) server.

This struct contains the necessary information to connect to an OTA server, including the protocol, hostname, and port number.

Public Attributes Documentation

variable protocol

cpp
ota_protocol_t ota_server_t::protocol

the protocol, the update should be downloaded with

variable hostname

cpp
char* ota_server_t::hostname

the DNS hostname of the OTA server

variable port

cpp
uint16_t ota_server_t::port

the TCP/UDP port number for the OTA download

variable filename

cpp
char* ota_server_t::filename

the OTA filename in case of OTA_PROTO_HTTP / OTA_PROTO_HTTPS

variable ota_http_params

cpp
struct ota_server_t ota_server_t::ota_http_params

variable cert

cpp
unsigned char* ota_server_t::cert

variable cert_len

cpp
unsigned int ota_server_t::cert_len

< the x.509 certificate of the serer for OTA_PROTO_HTTPS / OTA_PROTO_TLS

variable pin_pubkey_sha256

cpp
uint8_t ota_server_t::pin_pubkey_sha256[32]

< the len of the x.509 certificate

Server public-key SHA-256 pin (RR-S3-TLS-PIN-01, SR-TLS-PIN-01).

SHA-256 over the DER-encoded SubjectPublicKeyInfo (SPKI) of the server's leaf certificate — not over the full certificate. When set to a non-zero value, the OTA-TLS handshake fails unless the leaf SPKI hash matches; this is enforced in addition to the standard CA-chain verification (defense in depth against a compromised CA).

All-zero (default after memset/calloc) disables pinning and preserves the legacy CA-only behavior.

To compute on a PEM cert:

cpp
openssl x509 -in server.crt -pubkey -noout |
    openssl pkey -pubin -outform DER |
    openssl dgst -sha256 -binary |
    xxd -i

variable ota_tls_params

cpp
struct ota_server_t ota_server_t::ota_tls_params