mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 04:19:08 +08:00
[libu2f-server] New Port (#6781)
* update to 2.8.84 * [libu2f-server] Initial Port of Version 1.1.0 * Missing exported functions * Add support for static linkage * Added missing 'arm64' Target, and corrected case for 'arm' for vcpkg_install_msbuild * Add support for arm64 * Support for arm target * [libu2f-server] add cmakelists and patch * string copy fix * revert msbuild changes * add compile definitions * add patch file * remove line * change version
This commit is contained in:
parent
53a02456a0
commit
5b6b66512b
30
ports/libu2f-server/CMakeLists.txt
Normal file
30
ports/libu2f-server/CMakeLists.txt
Normal file
@ -0,0 +1,30 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(libu2f-server C)
|
||||
|
||||
file(GLOB_RECURSE LIBU2F_SERVER_HEADERS u2f-server/*.h)
|
||||
file(GLOB_RECURSE LIBU2F_SERVER_SOURCE u2f-server/*.c)
|
||||
|
||||
add_library(libu2f-server ${LIBU2F_SERVER_SOURCE})
|
||||
|
||||
target_include_directories(libu2f-server PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>)
|
||||
target_compile_definitions(libu2f-server PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE)
|
||||
|
||||
find_package(json-c CONFIG REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(libu2f-server PRIVATE OpenSSL::SSL OpenSSL::Crypto json-c::json-c)
|
||||
|
||||
install(TARGETS libu2f-server
|
||||
EXPORT libu2f-serverConfig
|
||||
RUNTIME DESTINATION "bin"
|
||||
ARCHIVE DESTINATION "lib"
|
||||
LIBRARY DESTINATION "lib"
|
||||
)
|
||||
|
||||
INSTALL(FILES ${LIBU2F_SERVER_HEADERS} DESTINATION "include/libu2f-server")
|
||||
|
||||
install(EXPORT libu2f-serverConfig
|
||||
FILE libu2f-serverConfig.cmake
|
||||
NAMESPACE libu2f-server::
|
||||
DESTINATION "share/libu2f-server"
|
||||
)
|
4
ports/libu2f-server/CONTROL
Normal file
4
ports/libu2f-server/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: libu2f-server
|
||||
Version: 1.1.0
|
||||
Build-Depends: openssl, json-c
|
||||
Description: Yubico Universal 2nd Factor (U2F) Server C Library
|
31
ports/libu2f-server/portfile.cmake
Normal file
31
ports/libu2f-server/portfile.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO Yubico/libu2f-server
|
||||
REF libu2f-server-1.1.0
|
||||
SHA512 085f8e7d74c1efb347747b8930386f18ba870f668f82e9bd479c9f8431585c5dc7f95b2f6b82bdd3a6de0c06f8cb2fbf51c363ced54255a936ab96536158ee59
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
windows.patch
|
||||
strndup-fix.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/u2f-server-version.h DESTINATION ${SOURCE_PATH}/u2f-server)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
# Handle copyright
|
||||
configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
|
31
ports/libu2f-server/strndup-fix.patch
Normal file
31
ports/libu2f-server/strndup-fix.patch
Normal file
@ -0,0 +1,31 @@
|
||||
diff --git a/u2f-server/core.c b/u2f-server/core.c
|
||||
index 294c94b..746932b 100644
|
||||
--- a/u2f-server/core.c
|
||||
+++ b/u2f-server/core.c
|
||||
@@ -211,7 +211,7 @@ u2fs_rc u2fs_set_keyHandle(u2fs_ctx_t * ctx, const char *keyHandle)
|
||||
ctx->keyHandle = NULL;
|
||||
}
|
||||
|
||||
- ctx->keyHandle = strndup(keyHandle, strlen(keyHandle));
|
||||
+ ctx->keyHandle = strdup(keyHandle);
|
||||
|
||||
if (ctx->keyHandle == NULL)
|
||||
return U2FS_MEMORY_ERROR;
|
||||
@@ -726,7 +726,7 @@ static u2fs_rc decode_clientData(const char *clientData, char **output)
|
||||
fprintf(stderr, "clientData: %s\n", data);
|
||||
}
|
||||
|
||||
- *output = strndup(data, strlen(data));
|
||||
+ *output = strdup(data);
|
||||
|
||||
free(data);
|
||||
data = NULL;
|
||||
@@ -870,7 +870,7 @@ u2fs_rc u2fs_registration_verify(u2fs_ctx_t * ctx, const char *response,
|
||||
goto failure;
|
||||
|
||||
u2fs_EC_KEY_t *key_ptr;
|
||||
- (*output)->keyHandle = strndup(buf, strlen(buf));
|
||||
+ (*output)->keyHandle = strdup(buf);
|
||||
|
||||
rc = decode_user_key(user_public_key, &key_ptr);
|
||||
if (rc != U2FS_OK)
|
94
ports/libu2f-server/u2f-server-version.h
Normal file
94
ports/libu2f-server/u2f-server-version.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Yubico AB
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef U2F_SERVER_VERSION_H
|
||||
#define U2F_SERVER_VERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* U2FS_VERSION_STRING
|
||||
*
|
||||
* Pre-processor symbol with a string that describe the header file
|
||||
* version number. Used together with u2fs_check_version() to verify
|
||||
* header file and run-time library consistency.
|
||||
*/
|
||||
#define U2FS_VERSION_STRING "1.1.0"
|
||||
|
||||
/**
|
||||
* U2FS_VERSION_NUMBER
|
||||
*
|
||||
* Pre-processor symbol with a hexadecimal value describing the header
|
||||
* file version number. For example, when the header version is 1.2.3
|
||||
* this symbol will have the value 0x01020300. The last two digits
|
||||
* are only used between public releases, and will otherwise be 00.
|
||||
*/
|
||||
#define U2FS_VERSION_NUMBER 0x01010000
|
||||
|
||||
/**
|
||||
* U2FS_VERSION_MAJOR
|
||||
*
|
||||
* Pre-processor symbol with a decimal value that describe the major
|
||||
* level of the header file version number. For example, when the
|
||||
* header version is 1.2.3 this symbol will be 1.
|
||||
*/
|
||||
#define U2FS_VERSION_MAJOR 1
|
||||
|
||||
/**
|
||||
* U2FS_VERSION_MINOR
|
||||
*
|
||||
* Pre-processor symbol with a decimal value that describe the minor
|
||||
* level of the header file version number. For example, when the
|
||||
* header version is 1.2.3 this symbol will be 2.
|
||||
*/
|
||||
#define U2FS_VERSION_MINOR 1
|
||||
|
||||
/**
|
||||
* U2FS_VERSION_PATCH
|
||||
*
|
||||
* Pre-processor symbol with a decimal value that describe the patch
|
||||
* level of the header file version number. For example, when the
|
||||
* header version is 1.2.3 this symbol will be 3.
|
||||
*/
|
||||
#define U2FS_VERSION_PATCH 0
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
41
ports/libu2f-server/windows.patch
Normal file
41
ports/libu2f-server/windows.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/u2f-server/cdecode.c b/u2f-server/cdecode.c
|
||||
index 6fff114..dc05ca5 100644
|
||||
--- a/u2f-server/cdecode.c
|
||||
+++ b/u2f-server/cdecode.c
|
||||
@@ -5,7 +5,7 @@ This is part of the libb64 project, and has been placed in the public domain.
|
||||
For details, see http://sourceforge.net/projects/libb64
|
||||
*/
|
||||
|
||||
-#include <b64/cdecode.h>
|
||||
+#include "b64/cdecode.h"
|
||||
|
||||
int base64_decode_value(char value_in)
|
||||
{
|
||||
diff --git a/u2f-server/cencode.c b/u2f-server/cencode.c
|
||||
index eebb24a..f3b7fa4 100644
|
||||
--- a/u2f-server/cencode.c
|
||||
+++ b/u2f-server/cencode.c
|
||||
@@ -5,7 +5,7 @@ This is part of the libb64 project, and has been placed in the public domain.
|
||||
For details, see http://sourceforge.net/projects/libb64
|
||||
*/
|
||||
|
||||
-#include <b64/cencode.h>
|
||||
+#include "b64/cencode.h"
|
||||
|
||||
const int CHARS_PER_LINE = 72;
|
||||
|
||||
diff --git a/u2f-server/core.c b/u2f-server/core.c
|
||||
index da440ec..294c94b 100644
|
||||
--- a/u2f-server/core.c
|
||||
+++ b/u2f-server/core.c
|
||||
@@ -30,8 +30,7 @@
|
||||
#include "internal.h"
|
||||
|
||||
#include <string.h>
|
||||
-#include <unistd.h>
|
||||
-#include <json.h>
|
||||
+#include <json-c/json.h>
|
||||
#include "crypto.h"
|
||||
#include "b64/cencode.h"
|
||||
#include "b64/cdecode.h"
|
||||
|
Loading…
Reference in New Issue
Block a user