diff --git a/lib/internal.h b/lib/internal.h index c718bc95..0463004a 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -85,4 +85,6 @@ struct backend_functions YH_INTERNAL *fuzz_backend_functions(void); struct backend_functions *backend_functions(void); #endif +void increment_ctr(uint8_t *ctr, size_t len); + #endif diff --git a/lib/lib_util.c b/lib/lib_util.c index ee719c60..59a68e3e 100644 --- a/lib/lib_util.c +++ b/lib/lib_util.c @@ -181,3 +181,11 @@ bool parse_usb_url(const char *url, unsigned long *serial) { } return false; } + +void increment_ctr(uint8_t *ctr, size_t len) { + while (len > 0) { + if (++ctr[--len]) { + break; + } + } +} diff --git a/lib/yubihsm.c b/lib/yubihsm.c index d467b729..83ff63d3 100644 --- a/lib/yubihsm.c +++ b/lib/yubihsm.c @@ -191,19 +191,6 @@ static return yrc; } -#ifndef FUZZING -static -#endif - void - increment_ctr(uint8_t *ctr, uint16_t len) { - - while (len > 0) { - if (++ctr[--len]) { - break; - } - } -} - static yh_rc translate_device_error(uint8_t device_error) { enum { diff --git a/lib/yubihsm.h b/lib/yubihsm.h index 077b7143..e70b69e6 100644 --- a/lib/yubihsm.h +++ b/lib/yubihsm.h @@ -3193,7 +3193,6 @@ yh_rc yh_domains_to_string(uint16_t domains, char *string, size_t max_len); yh_rc compute_cryptogram(const uint8_t *key, uint16_t key_len, uint8_t type, const uint8_t context[SCP_CONTEXT_LEN], uint16_t L, uint8_t *key_out); -void increment_ctr(uint8_t *ctr, uint16_t len); #endif #endif diff --git a/pkcs11/util_pkcs11.c b/pkcs11/util_pkcs11.c index c65b7861..fb525e7e 100644 --- a/pkcs11/util_pkcs11.c +++ b/pkcs11/util_pkcs11.c @@ -6092,14 +6092,6 @@ bool match_meta_attributes(yubihsm_pkcs11_session *session, return true; } -static void increment_ctr(uint8_t *ctr, size_t len) { - while (len > 0) { - if (++ctr[--len]) { - break; - } - } -} - CK_RV ecdh_with_kdf(ecdh_session_key *shared_secret, uint8_t *fixed_info, size_t fixed_len, CK_ULONG kdf, size_t value_len) {