Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jun 12, 2024
1 parent 5e8c087 commit 24ec32f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int mbedtls_base64_decode(unsigned char *dst, size_t dlen, size_t *olen,

// secretbase - internals ------------------------------------------------------

SEXP rawToChar(const unsigned char *buf, const size_t sz) {
static SEXP rawToChar(const unsigned char *buf, const size_t sz) {

SEXP out;
int i, j;
Expand All @@ -260,7 +260,7 @@ SEXP rawToChar(const unsigned char *buf, const size_t sz) {

}

static void nano_read_bytes(R_inpstream_t stream, void *dst, int len) {
static inline void nano_read_bytes(R_inpstream_t stream, void *dst, int len) {

nano_buf *buf = (nano_buf *) stream->data;
if (buf->cur + len > buf->len) Rf_error("unserialization error");
Expand All @@ -270,7 +270,7 @@ static void nano_read_bytes(R_inpstream_t stream, void *dst, int len) {

}

static void nano_write_bytes(R_outpstream_t stream, void *src, int len) {
static inline void nano_write_bytes(R_outpstream_t stream, void *src, int len) {

nano_buf *buf = (nano_buf *) stream->data;

Expand Down
4 changes: 2 additions & 2 deletions src/secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static void mbedtls_sha3_finish(mbedtls_sha3_context *ctx, uint8_t *output, size
static void * (*const volatile secure_memset)(void *, int, size_t) = memset;
#endif

void clear_buffer(void *buf, size_t sz) {
inline void clear_buffer(void *buf, size_t sz) {
#ifdef MBEDTLS_CT_ASM
memset(buf, 0, sz);
asm volatile ("" ::: "memory");
Expand All @@ -227,7 +227,7 @@ void clear_buffer(void *buf, size_t sz) {
#endif
}

static void hash_bytes(R_outpstream_t stream, void *src, int len) {
static inline void hash_bytes(R_outpstream_t stream, void *src, int len) {

secretbase_sha3_context *sctx = (secretbase_sha3_context *) stream->data;
sctx->skip ? (void) sctx->skip-- : mbedtls_sha3_update(sctx->ctx, (uint8_t *) src, (size_t) len);
Expand Down
2 changes: 1 addition & 1 deletion src/secret2.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ static void mbedtls_sha256_finish(mbedtls_sha256_context *ctx,

// secretbase - internals ------------------------------------------------------

static void hash_bytes(R_outpstream_t stream, void *src, int len) {
static inline void hash_bytes(R_outpstream_t stream, void *src, int len) {

secretbase_sha256_context *sctx = (secretbase_sha256_context *) stream->data;
sctx->skip ? (void) sctx->skip-- : mbedtls_sha256_update(sctx->ctx, (uint8_t *) src, (size_t) len);
Expand Down
6 changes: 3 additions & 3 deletions src/secret3.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static inline void c_siphash_sipround(CSipHash *state) {
state->v2 = c_siphash_rotate_left(state->v2, 32);
}

void c_siphash_init(CSipHash *state, const uint8_t seed[16]) {
static void c_siphash_init(CSipHash *state, const uint8_t seed[16]) {

uint64_t k0, k1;

Expand All @@ -94,7 +94,7 @@ void c_siphash_init(CSipHash *state, const uint8_t seed[16]) {

}

void c_siphash_init_nokey(CSipHash *state) {
static void c_siphash_init_nokey(CSipHash *state) {

*state = (CSipHash) {
.v0 = 0x736f6d6570736575ULL,
Expand Down Expand Up @@ -182,7 +182,7 @@ static inline uint64_t c_siphash_finalize(CSipHash *state) {

// secretbase - internals ------------------------------------------------------

static void hash_bytes(R_outpstream_t stream, void *src, int len) {
static inline void hash_bytes(R_outpstream_t stream, void *src, int len) {

secretbase_siphash_context *sctx = (secretbase_siphash_context *) stream->data;
sctx->skip ? (void) sctx->skip-- : c_siphash_append(sctx->ctx, (uint8_t *) src, (size_t) len);
Expand Down

0 comments on commit 24ec32f

Please sign in to comment.