libvuptsdk (git.securityops.co/cristiancmoises/libvuptsdk) is the renamed libzuptsdk: only the .so filename/SONAME changed (libzuptsdk.so.2 -> libvuptsdk.so.2); the C API (zuptsdk_* symbols, zuptsdk.h) is unchanged. - Rename vendor/zuptsdk -> vendor/vuptsdk with libvuptsdk's headers. - Makefile WITH_SDK=1 now links -lvuptsdk (+ its transitive libcrypto/libargon2 deps via SDK_DEPLIBS) instead of -lzuptsdk, and installs libvuptsdk.so.*. - DECOUPLE --pq-box: it needs the SEPARATE libpqvaptvupt, which libvuptsdk does NOT provide, so gate it behind a new WITH_PQBOX=1 (was folded into WITH_SDK). zupt_crypto_pqbox.c now keys on ZUPT_WITH_PQBOX; WITH_SDK=1 alone builds and links cleanly with just libvuptsdk and enables --pq-sdk + Argon2id. - Banner/help renamed libzuptsdk -> libvuptsdk; the machine-readable 'Build:' line lists --pq-box only under WITH_PQBOX. GUI _get_caps matches on 'vuptsdk'. Validated on Guix: WITH_SDK=1 links libvuptsdk + libcrypto + libargon2, runs, banner 'Build: full (libvuptsdk: Argon2id, --pq-sdk available)', keygen --sdk + --pq-sdk encrypt/decrypt byte-exact roundtrip. Default source-only build unchanged (make check 16/16).
57 lines
1.7 KiB
C
57 lines
1.7 KiB
C
/* vuptsdk observability — metrics & structured logging hooks
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
#ifndef ZUPTSDK_METRICS_H
|
|
#define ZUPTSDK_METRICS_H
|
|
|
|
#include "zuptsdk.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct {
|
|
uint64_t encrypt_pq_count;
|
|
uint64_t decrypt_pq_count;
|
|
uint64_t encrypt_password_count;
|
|
uint64_t decrypt_password_count;
|
|
uint64_t encrypt_field_count;
|
|
uint64_t decrypt_field_count;
|
|
uint64_t encrypt_failures;
|
|
uint64_t decrypt_failures;
|
|
uint64_t mac_failures;
|
|
uint64_t commitment_failures;
|
|
uint64_t fault_detections;
|
|
uint64_t bytes_encrypted;
|
|
uint64_t bytes_decrypted;
|
|
uint64_t total_latency_ns;
|
|
} zuptsdk_metrics_t;
|
|
|
|
/** Get a snapshot of accumulated metrics (thread-safe, atomic read). */
|
|
void zuptsdk_metrics_snapshot(zuptsdk_metrics_t *out);
|
|
|
|
/** Reset all counters to zero. */
|
|
void zuptsdk_metrics_reset(void);
|
|
|
|
/** Render snapshot in Prometheus exposition format to a buffer.
|
|
* Returns bytes written, or -1 if buf too small.
|
|
* If out is NULL, returns required size. */
|
|
int zuptsdk_metrics_render_prometheus(char *buf, size_t buf_sz);
|
|
|
|
/** Structured log callback for ops. Called on each encrypt/decrypt with
|
|
* outcome and timing. Set to NULL to disable.
|
|
* @param op "encrypt_pq" / "decrypt_pq" / "encrypt_password" / etc.
|
|
* @param rc error code (0 = OK)
|
|
* @param bytes plaintext bytes processed
|
|
* @param duration_ns elapsed time
|
|
*/
|
|
typedef void (*zuptsdk_op_log_t)(const char *op, int rc, size_t bytes,
|
|
uint64_t duration_ns, void *userdata);
|
|
|
|
void zuptsdk_set_op_log(zuptsdk_op_log_t cb, void *userdata);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|