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_ECDH 18
27
29#define OPENPGP_ALGO_ECDSA 19
30
32#define OPENPGP_ALGO_EDDSA 22
33
34/* === RFC 6637 ECDH KDF parameters (P-256 encryption subkey) === */
35
37#define OPENPGP_ECDH_KDF_HASH 0x08
38
40#define OPENPGP_ECDH_KDF_SYM 0x07
41
42/* === Fingerprint and digest sizes === */
43
45#define OPENPGP_FINGERPRINT_SIZE 20
46
48#define SHA256_DIGEST_SIZE 32
49
50/* === P-256 (secp256r1) sizes === */
51
53#define P256_PUBKEY_SIZE 65
54
56#define P256_PRIVKEY_SIZE 32
57
59#define P256_ECDH_SECRET_SIZE 32
60
69#define P256_PUBKEY_BITS 515
70
71/* === Ed25519 sizes === */
72
74#define ED25519_PUBKEY_SIZE 32
75
76/* === OpenPGP MPI sizes (RFC 4880 Section 3.2: 2-byte length prefix + payload) === */
77
79#define MPI_HEADER_SIZE 2
80
82#define MPI_FULL_SIZE_ED25519 (MPI_HEADER_SIZE + ED25519_PUBKEY_SIZE)
83
85#define MPI_FULL_SIZE_P256 (MPI_HEADER_SIZE + P256_PUBKEY_SIZE)
86
87/* === OpenPGP Smart Card password reference codes (Spec 3.4.1, Section 7.2.2) === */
88
90#define PW1_CODE_1 0x81
91
93#define PW1_CODE_2 0x82
94
96#define PW3_CODE 0x83
97
98#ifdef __cplusplus
99}
100#endif
101