Skip to content

Commit

Permalink
Remove copy of increment_ctr()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgeana committed Sep 30, 2024
1 parent 034dd74 commit cb97990
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
2 changes: 2 additions & 0 deletions lib/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions lib/lib_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
13 changes: 0 additions & 13 deletions lib/yubihsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion lib/yubihsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions pkcs11/util_pkcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down

0 comments on commit cb97990

Please sign in to comment.