The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
signature.c File Reference

librat: check the signature of the package index with the public keys of the image. More...

#include "internal.h"
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <mbedtls/ecp.h>
#include <mbedtls/pk.h>
#include "sha2.h"

Macros

#define KEY_FILE_MAX   8192
 the largest key file

Functions

int rat_signature_check (const rat_t *rat, const void *data, size_t size, const void *signature, size_t signature_size, rat_error_t *err)
 check a detached signature: ECDSA P-256 over the SHA-256 of the data, in DER.

Detailed Description

librat: check the signature of the package index with the public keys of the image.

the signature is ECDSA with the curve P-256 over the SHA-256 of the data, in DER, as "openssl dgst -sha256 -sign" writes it. the keys are PEM files in <root>/etc/rat/keys. a signature is good when one of the keys verifies it.

Macro Definition Documentation

◆ KEY_FILE_MAX

#define KEY_FILE_MAX   8192

the largest key file

Function Documentation

◆ rat_signature_check()

int rat_signature_check ( const rat_t * rat,
const void * data,
size_t size,
const void * signature,
size_t signature_size,
rat_error_t * err )

check a detached signature: ECDSA P-256 over the SHA-256 of the data, in DER.

one of the keys in <root>/etc/rat/keys must verify it.

Returns
0 when the signature is good, or -1.