CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1
14
15#pragma once
16#include <stddef.h>
17#include <stdint.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/* === RFC 4880 Public-Key Algorithm Identifiers === */
24
26#define OPENPGP_ALGO_ECDSA 19
27
29#define OPENPGP_ALGO_EDDSA 22
30
31/* === Fingerprint and digest sizes === */
32
34#define OPENPGP_FINGERPRINT_SIZE 20
35
37#define SHA256_DIGEST_SIZE 32
38
39/* === P-256 (secp256r1) sizes === */
40
42#define P256_PUBKEY_SIZE 65
43
45#define P256_PRIVKEY_SIZE 32
46
48#define P256_ECDH_SECRET_SIZE 32
49
51#define P256_PUBKEY_BITS 520
52
53/* === Ed25519 sizes === */
54
56#define ED25519_PUBKEY_SIZE 32
57
58/* === OpenPGP MPI sizes (RFC 4880 Section 3.2: 2-byte length prefix + payload) === */
59
61#define MPI_HEADER_SIZE 2
62
64#define MPI_FULL_SIZE_ED25519 (MPI_HEADER_SIZE + ED25519_PUBKEY_SIZE)
65
67#define MPI_FULL_SIZE_P256 (MPI_HEADER_SIZE + P256_PUBKEY_SIZE)
68
69/* === OpenPGP Smart Card password reference codes (Spec 3.4.1, Section 7.2.2) === */
70
72#define PW1_CODE_1 0x81
73
75#define PW1_CODE_2 0x82
76
78#define PW3_CODE 0x83
79
80#ifdef __cplusplus
81}
82#endif
83