Skip to content

Commit

Permalink
Setting prototype for functions with no parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Aug 9, 2024
1 parent 0396312 commit 68ccb44
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 42 deletions.
13 changes: 7 additions & 6 deletions bench/bench.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ int main(void) {
bench_third_party();

bench_fp25519();
bench_x25519();
bench_ed25519();

bench_fp448();
bench_x448();
bench_ed448();

bench_hash25519();
// bench_x25519();
// bench_ed25519();
//
// bench_fp448();
// bench_x448();
// bench_ed448();

printf("==== End of Benchmarking ====\n");
return 0;
Expand Down
20 changes: 10 additions & 10 deletions bench/bench.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef PALETA_BENCH_H
#define PALETA_BENCH_H

void bench_third_party();
void bench_fp25519();
void bench_ecc25519();
void bench_x25519();
void bench_ed25519();
void bench_hash25519();
void bench_third_party(void);
void bench_fp25519(void);
void bench_ecc25519(void);
void bench_x25519(void);
void bench_ed25519(void);
void bench_hash25519(void);

void bench_fp448();
void bench_ecc448();
void bench_x448();
void bench_ed448();
void bench_fp448(void);
void bench_ecc448(void);
void bench_x448(void);
void bench_ed448(void);

#endif /* PALETA_BENCH_H */
4 changes: 2 additions & 2 deletions bench/bench_ecdh.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ static void bench_ecdh(const X_ECDH* ecdh) {
ecdh->freeKey(shared_secret);
}

void bench_x25519() {
void bench_x25519(void) {
printf("===== Benchmarking DH ====\n");
printf("====== X25519 x64 ======\n");
bench_ecdh(&X25519_x64);
printf("====== X25519 AVX2 ======\n");
bench_ecdh(&X25519);
}

void bench_x448() {
void bench_x448(void) {
printf("===== Benchmarking DH ====\n");
printf("====== X448 AVX2 ======\n");
bench_ecdh(&X448);
Expand Down
4 changes: 2 additions & 2 deletions bench/bench_eddsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ static void bench_ed448context(const SignatureSchemeCtx *eddsa) {
eddsa->freeSignature(signature);
}

void bench_ed25519() {
void bench_ed25519(void) {
printf("== Benchmarking EdDSA ====\n");
printf("====== Ed25519 AVX2 ======\n");
bench_ed255pure(&Ed25519.Pure);
}

void bench_ed448() {
void bench_ed448(void) {
printf("== Benchmarking EdDSA ====\n");
printf("====== Ed448 AVX2 ======\n");
bench_ed448context(&Ed448.PureContext);
Expand Down
4 changes: 2 additions & 2 deletions bench/bench_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void bench_4w(const Arith_4w *fp) {
fp->misc.free(c);
}

void bench_fp25519() {
void bench_fp25519(void) {
printf("=== Benchmarking Arith ===\n");
printf("====== p=2^255-19 ======\n");
printf("====== 1-way (full) ======\n");
Expand All @@ -76,7 +76,7 @@ void bench_fp25519() {
bench_4w(&Fp25519._4w_red.arith);
}

void bench_fp448() {
void bench_fp448(void) {
printf("=== Benchmarking Arith ===\n");
printf("==== p=2^448-2^224-1 =====\n");
printf("====== 1-way (full) ======\n");
Expand Down
2 changes: 1 addition & 1 deletion bench/bench_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include "clocks.h"

void bench_hash25519() {
void bench_hash25519(void) {
printf("=== Benchmarking Hash ====\n");
printf("===== Hash25519 AVX2 =====\n");

Expand Down
4 changes: 2 additions & 2 deletions bench/bench_third_party.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "clocks.h"

static void bench_sha512_2w() {
static void bench_sha512_2w(void) {
const int BENCH = 500;
const int NUM = 2;
const int MSG_LEN = 64;
Expand All @@ -25,7 +25,7 @@ static void bench_sha512_2w() {
}
}

void bench_third_party() {
void bench_third_party(void) {
const int BENCH = 500;
const int message_length = 64;
uint8_t message[message_length];
Expand Down
2 changes: 1 addition & 1 deletion bench/clocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <sys/time.h>
#include <time.h>

uint64_t time_now() {
uint64_t time_now(void) {
struct timeval tv;
uint64_t ret;

Expand Down
2 changes: 1 addition & 1 deletion bench/clocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
(unsigned long)((end_c - start_c) / iterations)); \
} while (0)

uint64_t time_now();
uint64_t time_now(void);
uint64_t cycles_now(void);

/* _CLOCKS_H_ */
Expand Down
2 changes: 1 addition & 1 deletion include/faz_eddsa_avx2.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace faz{
namespace eddsa{
#endif /* __cplusplus */

#define ZeroOperandReturnKey(X) uint8_t * (*X)()
#define ZeroOperandReturnKey(X) uint8_t * (*X)(void)
#define Oper1Void(NAME, TYPE) void (*NAME)(TYPE C)
#define Oper1File(NAME, TYPE) void (*NAME)(FILE* file, TYPE A)

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp25519_1w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ DECL(void, print)(FILE *file, argElement_1w a) {
print_hex_bytes(file, a_bytes, SIZE_FP25519);
}

DECL(argElement_1w, alloc)() {
DECL(argElement_1w, alloc)(void) {
return (argElement_1w) allocate_bytes((4 * ((NUM_DIGITS_FP25519 + 3) / 4)) * sizeof(uint64_t));
}

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp25519_2w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ DECL(__m256i, cmp)(argElement_2w a, argElement_2w b) {
return SET64(0, c1, 0, c0);
}

DECL(argElement_2w, alloc)() {
DECL(argElement_2w, alloc)(void) {
return (argElement_2w) allocate_bytes((NUM_DIGITS_FP25519 / 2) * sizeof(__m256i));
}

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp25519_4w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ DECL(void, srt)(argElement_4w c, argElement_4w a) {
FN(invsqrt)(c, c, a);
}

DECL(argElement_4w,alloc)() {
DECL(argElement_4w,alloc)(void) {
return (argElement_4w) allocate_bytes(NUM_DIGITS_FP25519 * sizeof(__m256i));
}

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp448_1w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ DECL(void, print)(FILE *file, argElement_1w a) {
print_hex_bytes(file, a_bytes, SIZE_FP448);
}

DECL(argElement_1w, alloc)() {
DECL(argElement_1w, alloc)(void) {
return (argElement_1w) allocate_bytes( (NUM_DIGITS_FP448) * sizeof(uint64_t));
}

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp448_2w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ DECL(__m256i, cmp)(argElement_2w a, argElement_2w b) {
return SET64(0, c1, 0, c0);
}

DECL(argElement_2w, alloc)() {
DECL(argElement_2w, alloc)(void) {
return (argElement_2w) allocate_bytes((NUM_DIGITS_FP448 / 2) * sizeof(__m256i));
}

Expand Down
2 changes: 1 addition & 1 deletion src/eltfp448_4w_redradix.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ DECL(void, ser)(uint8_t *buf, argElement_4w a) {
ser_Fp448_1w_redradix(buf+3*SIZE_FP448,a3);
}

DECL(argElement_4w,alloc)() {
DECL(argElement_4w,alloc)(void) {
return (argElement_4w) allocate_bytes(NUM_DIGITS_FP448 * sizeof(__m256i));
}

Expand Down
2 changes: 1 addition & 1 deletion src/ladder255.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "edwards255.h"
#include <string.h>

static inline uint8_t *allocX25519_Key() {
static inline uint8_t *allocX25519_Key(void) {
return (uint8_t *) allocate_bytes(ECDH25519_KEY_SIZE_BYTES * sizeof(uint8_t));
}

Expand Down
2 changes: 1 addition & 1 deletion src/ladder448.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* @return
*/
static inline uint8_t * allocX448_Key() {
static inline uint8_t * allocX448_Key(void) {
return (uint8_t*) allocate_bytes(ECDH448_KEY_SIZE_BYTES * sizeof(uint8_t));
}

Expand Down
4 changes: 2 additions & 2 deletions src/sign255.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ static inline void printEd25519_Signature(FILE * file,uint8_t *sig) {
*
* @return
*/
static inline uint8_t *allocEd25519_Key() {
static inline uint8_t *allocEd25519_Key(void) {
return (uint8_t *) allocate_bytes(ED25519_KEY_SIZE_BYTES_PARAM * sizeof(uint8_t));
}

/**
*
* @return
*/
static inline uint8_t *allocEd25519_Signature() {
static inline uint8_t *allocEd25519_Signature(void) {
return (uint8_t *) allocate_bytes(ED25519_SIG_SIZE_BYTES_PARAM * sizeof(uint8_t));
}

Expand Down
4 changes: 2 additions & 2 deletions src/sign448.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ static inline void printEd448_Signature(FILE *file, uint8_t *sig) {
*
* @return
*/
static inline uint8_t *allocEd448_Key() {
static inline uint8_t *allocEd448_Key(void) {
return (uint8_t *) allocate_bytes(ED448_KEY_SIZE_BYTES_PARAM * sizeof(uint8_t));
}

/**
*
* @return
*/
static inline uint8_t *allocEd448_Signature() {
static inline uint8_t *allocEd448_Signature(void) {
return (uint8_t *) allocate_bytes(ED448_SIG_SIZE_BYTES_PARAM * sizeof(uint8_t));
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/cpu_caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int cpu_has(enum Capabilities c) {
return ret;
}

void machine_info() {
void machine_info(void) {
printf("=== Environment Information ====\n");
printf("Program compiled with: %s\n", __VERSION__);
unsigned int eax, ebx, ecx, edx;
Expand Down
2 changes: 1 addition & 1 deletion third_party/cpu_caps.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
extern "C" {
#endif /* __cplusplus */

void machine_info();
void machine_info(void);

#ifdef __cplusplus
} /* extern C */
Expand Down

0 comments on commit 68ccb44

Please sign in to comment.