CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
pin_storage_c.cpp
Go to the documentation of this file.
1
5
8
9extern "C" {
10
14
15bool pin_storage_openpgp_verify_pw1(const char *pin) {
17}
18
19bool pin_storage_openpgp_verify_pw3(const char *pin) {
21}
22
23bool pin_storage_openpgp_change_pw1(const char *new_pin) {
25}
26
27bool pin_storage_openpgp_change_pw3(const char *new_pin) {
29}
30
31bool pin_storage_openpgp_verify_pw1_raw(const uint8_t *data, size_t len) {
33}
34
35bool pin_storage_openpgp_verify_pw3_raw(const uint8_t *data, size_t len) {
37}
38
39bool pin_storage_openpgp_set_pw1_raw(const uint8_t *data, size_t len) {
41}
42
43bool pin_storage_openpgp_set_pw3_raw(const uint8_t *data, size_t len) {
45}
46
50
54
58
62
66
70
73 bool ok1 = pm.setPW1(cdc::core::PinManager::DEFAULT_PW1);
74 bool ok3 = pm.setPW3(cdc::core::PinManager::DEFAULT_PW3);
75 pm.resetPW1Retries();
76 pm.resetPW3Retries();
77 return ok1 && ok3;
78}
79
82 pm.init();
83 return pm.isPinSet();
84}
85
88 pm.init();
90 return pm.getBadgePinHash(hash);
91}
92
93bool pin_storage_get_fido2_hash(uint8_t* hash_out) {
95 pm.init();
96 return pm.getBadgePinHash(hash_out);
97}
98
99bool pin_storage_verify_fido2_hash(const uint8_t* hash_in) {
101 pm.init();
102 return pm.verifyBadgePinHash(hash_in);
103}
104
108
112
113} // extern "C"
bool verifyPW1(const char *pin)
OpenPGP PW1 (user PIN) workflow.
bool setPW3Raw(const uint8_t *data, size_t len)
void resetPW1Retries()
Resets PW1 retry counter to maximum.
bool setPW3(const char *newPin)
Sets PW3 directly and refreshes salt/hash material.
uint8_t getPW1Retries() const
Definition PinManager.h:119
static constexpr uint8_t BADGE_HASH_SIZE
Definition PinManager.h:64
static constexpr const char * DEFAULT_PW1
Definition PinManager.h:75
void resetPW3Retries()
Resets PW3 retry counter to maximum.
static constexpr const char * DEFAULT_PW3
Definition PinManager.h:76
void setMinPinLengthFloor(uint8_t minLen)
Sets the minimum badge-PIN length floor enforced on changes.
bool isPW1Blocked() const
Definition PinManager.h:120
bool verifyPW3Raw(const uint8_t *data, size_t len)
OpenPGP KDF-DO path: PW3 reference is a host-supplied pre-hash.
bool setPW1Raw(const uint8_t *data, size_t len)
uint8_t getPW3Retries() const
Definition PinManager.h:135
static PinManager & instance()
Returns singleton PIN manager instance.
uint8_t minPinLengthFloor() const
Definition PinManager.h:97
bool isPW3Blocked() const
Definition PinManager.h:136
bool setPW1(const char *newPin)
Sets PW1 directly and refreshes salt/hash material.
bool init()
Initializes PIN state from secure storage or defaults.
bool verifyPW3(const char *pin)
OpenPGP PW3 (admin PIN) workflow.
bool verifyPW1Raw(const uint8_t *data, size_t len)
uint8_t pin_storage_openpgp_pw1_retries(void)
bool pin_storage_verify_fido2_hash(const uint8_t *hash_in)
bool pin_storage_openpgp_reset(void)
void pin_storage_openpgp_reset_pw1_retries(void)
bool pin_storage_fido2_available(void)
bool pin_storage_is_set(void)
bool pin_storage_openpgp_pw1_blocked(void)
uint8_t pin_storage_get_min_pin_floor(void)
bool pin_storage_openpgp_set_pw1_raw(const uint8_t *data, size_t len)
bool pin_storage_openpgp_verify_pw3_raw(const uint8_t *data, size_t len)
bool pin_storage_openpgp_change_pw3(const char *new_pin)
void pin_storage_set_min_pin_floor(uint8_t min_len)
uint8_t pin_storage_openpgp_pw3_retries(void)
bool pin_storage_openpgp_verify_pw1_raw(const uint8_t *data, size_t len)
bool pin_storage_openpgp_verify_pw1(const char *pin)
void pin_storage_openpgp_init(void)
bool pin_storage_openpgp_set_pw3_raw(const uint8_t *data, size_t len)
bool pin_storage_get_fido2_hash(uint8_t *hash_out)
bool pin_storage_openpgp_verify_pw3(const char *pin)
bool pin_storage_openpgp_change_pw1(const char *new_pin)
bool pin_storage_openpgp_pw3_blocked(void)
void pin_storage_openpgp_reset_pw3_retries(void)