add build flag to use libubox instead of provided base64 implementation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
24f880d718
commit
cf8dcdb8a4
@ -3,8 +3,18 @@ cmake_minimum_required(VERSION 2.8)
|
||||
PROJECT(usign C)
|
||||
ADD_DEFINITIONS(-O2 -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
|
||||
|
||||
SET(SOURCES ed25519.c edsign.c f25519.c fprime.c sha512.c base64.c main.c)
|
||||
SET(SOURCES ed25519.c edsign.c f25519.c fprime.c sha512.c main.c)
|
||||
|
||||
SET(LIBS)
|
||||
IF(USE_LIBUBOX)
|
||||
ADD_DEFINITIONS(-DUSE_LIBUBOX)
|
||||
SET(LIBS ubox)
|
||||
ELSE()
|
||||
SET(SOURCES ${SOURCES} base64.c)
|
||||
ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(usign ${SOURCES})
|
||||
TARGET_LINK_LIBRARIES(usign ${LIBS})
|
||||
|
||||
INSTALL(TARGETS usign
|
||||
RUNTIME DESTINATION bin
|
||||
|
4
base64.h
4
base64.h
@ -1,6 +1,9 @@
|
||||
#ifndef __BASE64_H
|
||||
#define __BASE64_H
|
||||
|
||||
#ifdef USE_LIBUBOX
|
||||
#include <libubox/utils.h>
|
||||
#else
|
||||
int b64_encode(const void *src, size_t src_len,
|
||||
void *dest, size_t dest_len);
|
||||
|
||||
@ -8,5 +11,6 @@ int b64_decode(const void *src, void *dest, size_t dest_len);
|
||||
|
||||
#define B64_ENCODE_LEN(_len) ((((_len) + 2) / 3) * 4 + 1)
|
||||
#define B64_DECODE_LEN(_len) (((_len) / 4) * 3 + 1)
|
||||
#endif /* USE_LIBUBOX */
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user