diff --git a/Implementierung/lib/helper.h b/Implementierung/lib/helper.h index 410940b..90ddbc4 100644 --- a/Implementierung/lib/helper.h +++ b/Implementierung/lib/helper.h @@ -2,10 +2,10 @@ #define HELPER_H #include -#include -#include -#include #include +#include +#include +#include enum argumentParseResult { RESULT_OK = 0, @@ -14,12 +14,21 @@ enum argumentParseResult { }; struct configuration { - char* filename; + char* filename; int implementationToUse; int doBenchmark; 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 \ No newline at end of file +#endif // HELPER_H \ No newline at end of file diff --git a/Implementierung/lib/io.h b/Implementierung/lib/io.h index a57a141..6082117 100644 --- a/Implementierung/lib/io.h +++ b/Implementierung/lib/io.h @@ -7,4 +7,13 @@ #include #include -#endif // IO_H \ No newline at end of file +/** + * @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 \ No newline at end of file diff --git a/Implementierung/lib/md2.h b/Implementierung/lib/md2.h index 0a972e7..356980f 100644 --- a/Implementierung/lib/md2.h +++ b/Implementierung/lib/md2.h @@ -2,5 +2,23 @@ #define MD2_H #include +#include + +/** + * @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 \ No newline at end of file