CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
constants.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define OPENPGP_ALGO_ECDSA   19
 Centralized magic-value constants for the OpenPGP smart-card application.
#define OPENPGP_ALGO_EDDSA   22
 OpenPGP algorithm ID for EdDSA (Ed25519).
#define OPENPGP_FINGERPRINT_SIZE   20
 OpenPGP v4 fingerprint size (SHA-1 digest length, in bytes).
#define SHA256_DIGEST_SIZE   32
 SHA-256 digest output size in bytes (FIPS 180-4).
#define P256_PUBKEY_SIZE   65
 P-256 uncompressed public key size: 0x04 || X(32) || Y(32).
#define P256_PRIVKEY_SIZE   32
 P-256 private key (scalar) size in bytes.
#define P256_ECDH_SECRET_SIZE   32
 P-256 ECDH shared secret size in bytes.
#define P256_PUBKEY_BITS   520
 P-256 public key bit-length (used as MPI bit count).
#define ED25519_PUBKEY_SIZE   32
 Ed25519 raw public key size in bytes.
#define MPI_HEADER_SIZE   2
 OpenPGP MPI header size (2-byte length prefix).
#define MPI_FULL_SIZE_ED25519   (MPI_HEADER_SIZE + ED25519_PUBKEY_SIZE)
 Full Ed25519 MPI buffer size: 2 byte length prefix + 32 byte key.
#define MPI_FULL_SIZE_P256   (MPI_HEADER_SIZE + P256_PUBKEY_SIZE)
 Full P-256 MPI buffer size: 2 byte length prefix + 65 byte uncompressed key.
#define PW1_CODE_1   0x81
 PW1 reference for signature operations (User PIN).
#define PW1_CODE_2   0x82
 PW1 reference for non-signature operations (User PIN, alt).
#define PW3_CODE   0x83
 PW3 reference (Admin PIN).

Macro Definition Documentation

◆ ED25519_PUBKEY_SIZE

#define ED25519_PUBKEY_SIZE   32

Ed25519 raw public key size in bytes.

Definition at line 56 of file constants.h.

Referenced by encode_pubkey_with_prefix(), key_fingerprint_generate(), and se_ecc_key_read().

◆ MPI_FULL_SIZE_ED25519

#define MPI_FULL_SIZE_ED25519   (MPI_HEADER_SIZE + ED25519_PUBKEY_SIZE)

Full Ed25519 MPI buffer size: 2 byte length prefix + 32 byte key.

Definition at line 64 of file constants.h.

◆ MPI_FULL_SIZE_P256

#define MPI_FULL_SIZE_P256   (MPI_HEADER_SIZE + P256_PUBKEY_SIZE)

Full P-256 MPI buffer size: 2 byte length prefix + 65 byte uncompressed key.

Definition at line 67 of file constants.h.

◆ MPI_HEADER_SIZE

#define MPI_HEADER_SIZE   2

OpenPGP MPI header size (2-byte length prefix).

Definition at line 61 of file constants.h.

◆ OPENPGP_ALGO_ECDSA

#define OPENPGP_ALGO_ECDSA   19

Centralized magic-value constants for the OpenPGP smart-card application.

Collects RFC 4880 algorithm identifiers, MPI sizes, OpenPGP card password reference codes, and curve specific cryptographic key/digest sizes that are used across the OpenPGP implementation in mod_gpg.

References:

  • OpenPGP RFC 4880 Section 9.1: Public-Key Algorithm IDs
  • OpenPGP Smart Card Application 3.4.1, Section 4.4 / Section 6
  • SEC 1: Elliptic Curve Cryptography (uncompressed point format)
  • FIPS 180-4: SHA-256 specification

OpenPGP algorithm ID for ECDSA (RFC 4880 Section 9.1).

Definition at line 26 of file constants.h.

Referenced by cdc::mod_gpg::gpgBuildSignedKeyArmored(), and cdc::mod_gpg::gpgCrossSign().

◆ OPENPGP_ALGO_EDDSA

#define OPENPGP_ALGO_EDDSA   22

OpenPGP algorithm ID for EdDSA (Ed25519).

Definition at line 29 of file constants.h.

Referenced by cdc::mod_gpg::gpgBuildSignedKeyArmored(), and cdc::mod_gpg::gpgCrossSign().

◆ OPENPGP_FINGERPRINT_SIZE

#define OPENPGP_FINGERPRINT_SIZE   20

OpenPGP v4 fingerprint size (SHA-1 digest length, in bytes).

Definition at line 34 of file constants.h.

Referenced by build_do_app_related(), cmd_get_data(), find_put_data_desc(), fp_is_set(), load_state_from_nvs(), openpgp_get_fingerprint(), openpgp_set_key_fingerprint(), and save_state_to_nvs().

◆ P256_ECDH_SECRET_SIZE

#define P256_ECDH_SECRET_SIZE   32

P-256 ECDH shared secret size in bytes.

Definition at line 48 of file constants.h.

Referenced by cmd_pso_decipher().

◆ P256_PRIVKEY_SIZE

#define P256_PRIVKEY_SIZE   32

P-256 private key (scalar) size in bytes.

Definition at line 45 of file constants.h.

Referenced by cmd_pso_decipher(), cmd_put_data_odd(), generate_dec_key(), gpg_generate_key(), and read_public_key().

◆ P256_PUBKEY_BITS

#define P256_PUBKEY_BITS   520

P-256 public key bit-length (used as MPI bit count).

Definition at line 51 of file constants.h.

◆ P256_PUBKEY_SIZE

#define P256_PUBKEY_SIZE   65

◆ PW1_CODE_1

#define PW1_CODE_1   0x81

PW1 reference for signature operations (User PIN).

Definition at line 72 of file constants.h.

Referenced by cmd_change_reference_data(), cmd_reset_retry_counter(), and cmd_verify().

◆ PW1_CODE_2

#define PW1_CODE_2   0x82

PW1 reference for non-signature operations (User PIN, alt).

Definition at line 75 of file constants.h.

Referenced by cmd_verify().

◆ PW3_CODE

#define PW3_CODE   0x83

PW3 reference (Admin PIN).

Definition at line 78 of file constants.h.

Referenced by cmd_change_reference_data(), and cmd_verify().

◆ SHA256_DIGEST_SIZE

#define SHA256_DIGEST_SIZE   32

SHA-256 digest output size in bytes (FIPS 180-4).

Definition at line 37 of file constants.h.

Referenced by cmd_pso_cds(), key_fingerprint_from_pubkey(), and cdc::core::verify_payload_signature().