cmake_minimum_required(VERSION 2.6)
PROJECT(ucert C)
-ADD_DEFINITIONS(-Os -ggdb -Wall --std=gnu99 -Wmissing-declarations)
+
+ADD_DEFINITIONS(-Wall -Werror)
+IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
+ ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration)
+ ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral)
+ENDIF()
+ADD_DEFINITIONS(-Os -std=gnu99 -ggdb -Wmissing-declarations -Wno-unused-parameter)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
static bool quiet;
#ifndef UCERT_STRIP_MESSAGES
-#define DPRINTF(format, ...) if (!quiet) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__)
+#define DPRINTF(format, ...) \
+ do { \
+ if (!quiet) \
+ fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__); \
+ } while (0)
#else
-#define DPRINTF(format, ...)
+#define DPRINTF(format, ...) do { } while (0)
#endif
/*
struct cert_object *cobj;
char filebuf[CERT_BUF_LEN];
int ret = 0, pret = 0;
- int len, pos = 0;
+ size_t len, pos = 0;
f = fopen(certfile, "r");
if (!f)
list_for_each_entry(cobj, chain, list) {
/* blob has payload, verify that using signature */
if (cobj->cert[CERT_ATTR_PAYLOAD]) {
- uint64_t validfrom;
- uint64_t expiresat;
+ time_t validfrom;
+ time_t expiresat;
uint32_t certtype;
ret = cert_verify_blob(cobj->cert, chainedpubkey[0]?chainedpubkey:pubkeyfile, pubkeydir);
struct blob_attr *payloadtb[CERT_PL_ATTR_MAX];
struct stat st;
struct timeval tv;
- uint64_t validfrom;
- uint32_t certtype;
+ time_t validfrom;
+ enum certtype_id certtype;
char *fingerprint;
char rfname[512];