Skip to content

Commit

Permalink
Revert to static function call
Browse files Browse the repository at this point in the history
  • Loading branch information
aveenismail committed Mar 20, 2024
1 parent 02f510c commit c084606
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 1 addition & 4 deletions common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
#include <ctype.h>
#include <string.h>

#include "util.h"

#ifndef _WIN32_BCRYPT
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/x509.h>

#include "openssl-compat.h"
#include "util.h"
#include "insecure_memzero.h"
#include "hash.h"

Expand Down Expand Up @@ -819,7 +817,6 @@ bool split_hmac_key(yh_algorithm algorithm, uint8_t *in, size_t in_len,

return true;
}
#endif

void increment_ctr(uint8_t *ctr, size_t len) {
while (len > 0) {
Expand Down
7 changes: 2 additions & 5 deletions common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
#ifndef YUBICOM_UTIL_H
#define YUBICOM_UTIL_H

#include <stdbool.h>
#include <stdint.h>

#ifndef _WIN32_BCRYPT
#include <openssl/bn.h>
#include <openssl/evp.h>
#include <stdbool.h>
#include <stdint.h>

#include <yubihsm.h>
#include "../common/platform-config.h"
Expand Down Expand Up @@ -64,7 +62,6 @@ bool YH_INTERNAL base64_decode(const char *in, uint8_t *out, size_t *len);

bool YH_INTERNAL split_hmac_key(yh_algorithm algorithm, uint8_t *in,
size_t in_len, uint8_t *out, size_t *out_len);
#endif
void YH_INTERNAL increment_ctr(uint8_t *ctr, size_t len);

#endif
1 change: 0 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ set (
${CMAKE_CURRENT_SOURCE_DIR}/../common/rand.c
${CMAKE_CURRENT_SOURCE_DIR}/../common/ecdh.c
${CMAKE_CURRENT_SOURCE_DIR}/../common/openssl-compat.c
${CMAKE_CURRENT_SOURCE_DIR}/../common/util.c
error.c
lib_util.c
yubihsm.c
Expand Down
10 changes: 9 additions & 1 deletion lib/yubihsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "../common/pkcs5.h"
#include "../common/hash.h"
#include "../common/ecdh.h"
#include "../common/util.h"

#include "../aes_cmac/aes_cmac.h"

Expand Down Expand Up @@ -183,6 +182,15 @@ static yh_rc compute_cryptogram(const uint8_t *key, uint16_t key_len,
return yrc;
}

static 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

0 comments on commit c084606

Please sign in to comment.