aheinecke@7: #ifndef LISTUTIL_H aheinecke@7: #define LISTUTIL_H aheinecke@7: aheinecke@7: #ifdef __cplusplus aheinecke@7: extern "C" { aheinecke@7: #endif aheinecke@4: aheinecke@4: #include aheinecke@4: aheinecke@4: /** aheinecke@4: * @file listutil.h aheinecke@4: * @brief Functions to work with the certificate list. aheinecke@4: */ aheinecke@4: aheinecke@7: /** aheinecke@7: * @brief Status of the List Operations aheinecke@7: */ aheinecke@4: typedef enum { aheinecke@4: Unknown = 0, // Not yet parsed aheinecke@4: UnknownError = 1, // The expected unexpected aheinecke@4: TooLarge = 2, // Failed because the file exeeds the limit aheinecke@4: InvalidFormat = 3, // File does not appear to be in list format aheinecke@4: InvalidSignature = 4, // Signature was invalid aheinecke@4: StatFailed = 5, // Could not stat the file aheinecke@4: ReadFailed = 6, // Could not read the file aheinecke@4: IncompatibleVersion = 7, // The Format Version does not match aheinecke@4: Valid = 8 // List is valid aheinecke@4: } list_status_t; aheinecke@4: aheinecke@4: /** aheinecke@4: * @brief Obtain the complete and verified Certificate list. aheinecke@4: * aheinecke@4: * This checks if the file fileName is a valid certificate aheinecke@4: * list signed by the key specified in pubkey.h aheinecke@4: * aheinecke@4: * The caller has to free data. aheinecke@4: * aheinecke@4: * @param[in] fileName Name of the file (UTF-8 encoded). aheinecke@4: * @param[out] data Newly allocated pointer to the file content. aheinecke@4: * @param[out] size Size in Bytes of the file content. aheinecke@4: * aheinecke@4: * @return status of the operation. aheinecke@4: */ aheinecke@7: list_status_t readAndVerifyList(const char *fileName, char **data, size_t *size); aheinecke@7: #ifdef __cplusplus aheinecke@7: } aheinecke@7: #endif aheinecke@7: #endif