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@31: Valid = 100, // Could be read and signature matched 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@31: SeekFailed = 5, // Could not seek in the file aheinecke@31: ReadFailed = 6, // File exists but could not read the file aheinecke@31: IncompatibleVersion = 7 // The Format Version does not match 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@28: list_status_t read_and_verify_list(const char *fileName, char **data, size_t *size); aheinecke@7: #ifdef __cplusplus aheinecke@7: } aheinecke@7: #endif aheinecke@7: #endif