wgtpkg: spliting of headers
[src/app-framework-main.git] / src / wgtpkg-certs.c
index b4b45fd..7310035 100644 (file)
@@ -1,6 +1,8 @@
 /*
  Copyright 2015 IoT.bzh
 
+ author: José Bollo <jose.bollo@iot.bzh>
+
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
 */
 
 
-#include <syslog.h>
 #include <openssl/x509.h>
 
-#include "wgtpkg.h"
+#include "verbose.h"
+#include "wgtpkg-certs.h"
+#include "wgtpkg-base64.h"
 
 struct x509l {
        int count;
@@ -31,7 +34,7 @@ static int add_certificate_x509(X509 *x)
 {
        X509 **p = realloc(certificates.certs, (certificates.count + 1) * sizeof(X509*));
        if (!p) {
-               syslog(LOG_ERR, "reallocation failed for certificate");
+               ERROR("reallocation failed for certificate");
                return -1;
        }
        certificates.certs = p;
@@ -48,7 +51,7 @@ static int add_certificate_bin(const char *bin, int len)
        while (b < e) {
                X509 *x =  d2i_X509(NULL, (const unsigned char **)&b, e-b);
                if (x == NULL) {
-                       syslog(LOG_ERR, "d2i_X509 failed");
+                       ERROR("d2i_X509 failed");
                        return -1;
                }
                rc = add_certificate_x509(x);