Commit 3e3d9e95 authored by Ivan Tyagov's avatar Ivan Tyagov

X509

See merge request nexedi/osie!13
parents e5722c00 39d24d4c
CC=$(C_COMPILER)
CFLAGS= -I $(OPEN62541_SOURCE_HOME)
LDFLAGS= -L $(OPEN62541_HOME)/lib
LDFLAGS= -L $(OPEN62541_HOME)/lib -lmbedcrypto -lmbedx509
OUT_DIR= $(BINARY_OUT_DIR)
server: server.c
......
/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
* See http://creativecommons.org/publicdomain/zero/1.0/for more information. */
#include "open62541.h"
/* loadFile parses the certificate file.
*
* @param path specifies the file name given in argv[]
* @return Returns the file content after parsing */
static UA_INLINE UA_ByteString
loadFile(const char *const path) {
UA_ByteString fileContents = UA_STRING_NULL;
/* Open the file */
FILE *fp = fopen(path, "rb");
if(!fp) {
errno = 0; /* We read errno also from the tcp layer... */
return fileContents;
}
/* Get the file length, allocate the data and read */
fseek(fp, 0, SEEK_END);
fileContents.length = (size_t)ftell(fp);
fileContents.data = (UA_Byte *)UA_malloc(fileContents.length * sizeof(UA_Byte));
if(fileContents.data) {
fseek(fp, 0, SEEK_SET);
size_t read = fread(fileContents.data, sizeof(UA_Byte), fileContents.length, fp);
if(read != fileContents.length)
UA_ByteString_clear(&fileContents);
} else {
fileContents.length = 0;
}
fclose(fp);
return fileContents;
}
This diff is collapsed.
......@@ -22,6 +22,7 @@ recipe = slapos.recipe.build:gitclone
repository = https://github.com/open62541/open62541.git
branch = master
git-executable = ${git:location}/bin/git
revision = 931e0f0c0be04c311ef3c647d580b6eed01f40b3
[open62541]
recipe = slapos.recipe.cmmi
......@@ -37,6 +38,8 @@ configure-options =
-DUA_ENABLE_PUBSUB_MONITORING=ON
-DUA_NAMESPACE_ZERO=FULL
-DUA_ENABLE_AMALGAMATION=ON
-DUA_ENABLE_ENCRYPTION=MBEDTLS
-DUA_ENABLE_ENCRYPTION_MBEDTLS=ON
[osie-repository]
recipe = slapos.recipe.build:gitclone
......@@ -44,6 +47,7 @@ git-executable = ${git:location}/bin/git
# token must be removed if going public!!!
repository = https://gitlab+deploy-token-4:pLwtBu8TbusqZDKPUpZA@lab.nexedi.com/nexedi/osie.git
location = ${buildout:parts-directory}/osie
branch = x509
[compile-coupler]
recipe = slapos.recipe.cmmi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment