Chore: Add doc comments

This commit is contained in:
Dorian Zedler 2022-06-29 11:08:31 +02:00
parent 4d2e3e16e3
commit 6401660479
Signed by: dorian
GPG key ID: 989DE36109AFA354
3 changed files with 43 additions and 7 deletions

View file

@ -2,10 +2,10 @@
#define HELPER_H #define HELPER_H
#include <errno.h> #include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h> #include <getopt.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
enum argumentParseResult { enum argumentParseResult {
RESULT_OK = 0, RESULT_OK = 0,
@ -20,6 +20,15 @@ struct configuration {
int benchmarkingCycles; int benchmarkingCycles;
}; };
enum argumentParseResult parseArguments(int argc, char** argv, struct configuration* c); /**
* @brief parse commandline arguments to config and print errors, if any
*
* @param argc argc
* @param argv argv
* @param c pointer where the configuration should be stored
* @return enum argumentParseResult
*/
enum argumentParseResult parseArguments(int argc, char** argv,
struct configuration* c);
#endif // HELPER_H #endif // HELPER_H

View file

@ -7,4 +7,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
/**
* @brief reads a file at a path
*
* @param path the filepath
* @param size a pointer where the size of the result should be stored
* @return the raw data
*/
static uint8_t* read_file(const char* path, size_t* size);
#endif // IO_H #endif // IO_H

View file

@ -2,5 +2,23 @@
#define MD2_H #define MD2_H
#include <stdint.h> #include <stdint.h>
#include <sys/types.h>
/**
* @brief Calculates checksum of buf and stores it in out
*
* @param len Length of the data at buf
* @param buf Location of the data
* @param out Destination array of for the checksum
*/
void md2_hash(size_t len, const uint8_t buf[], uint8_t out[16]);
/**
* @brief Calculates checksum of buf and appends it to buf
*
* @param len Length of data which the checksum should be calculated of
* @param buf Location of the data. Make sure to reserve 16 bytes more so the chechsum fits!
*/
void md2_checksum(size_t len, uint8_t* buf);
#endif // MD2_H #endif // MD2_H