early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,72 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 75b82ee..47bed29 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,11 +3,7 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(uthenticode)
find_package(pe-parse REQUIRED)
-find_package(
- OpenSSL 1.1
- COMPONENTS Crypto
- REQUIRED
-)
+find_package(OpenSSL REQUIRED)
add_library("${PROJECT_NAME}" uthenticode.cpp)
@@ -38,7 +34,7 @@ else ()
target_link_libraries("${PROJECT_NAME}" PUBLIC pe-parse::pe-parser-library)
endif ()
-target_link_libraries("${PROJECT_NAME}" PUBLIC OpenSSL::Crypto)
+target_link_libraries("${PROJECT_NAME}" PUBLIC OpenSSL::SSL OpenSSL::Crypto)
install(
TARGETS "${PROJECT_NAME}"
diff --git a/src/include/uthenticode.h b/src/include/uthenticode.h
index 8422cc3..938d8b8 100644
--- a/src/include/uthenticode.h
+++ b/src/include/uthenticode.h
@@ -48,6 +48,7 @@ DECLARE_ASN1_FUNCTIONS(Authenticode_SpcIndirectDataContent)
* So we wrap it here for use with unique_ptr.
*/
void OpenSSL_free(void *ptr);
+void SK_X509_free(stack_st_X509 *ptr);
/* Convenient self-releasing aliases for libcrypto and custom ASN.1 types.
*/
@@ -56,7 +57,7 @@ using ASN1_OBJECT_ptr = std::unique_ptr<ASN1_OBJECT, decltype(&ASN1_OBJECT_free)
using ASN1_TYPE_ptr = std::unique_ptr<ASN1_TYPE, decltype(&ASN1_TYPE_free)>;
using OpenSSL_ptr = std::unique_ptr<char, decltype(&OpenSSL_free)>;
using BN_ptr = std::unique_ptr<BIGNUM, decltype(&BN_free)>;
-using STACK_OF_X509_ptr = std::unique_ptr<STACK_OF(X509), decltype(&sk_X509_free)>;
+using STACK_OF_X509_ptr = std::unique_ptr<STACK_OF(X509), decltype(&SK_X509_free)>;
using SectionList = std::vector<const peparse::bounded_buffer *>;
diff --git a/src/uthenticode.cpp b/src/uthenticode.cpp
index b1be0bc..7043589 100644
--- a/src/uthenticode.cpp
+++ b/src/uthenticode.cpp
@@ -39,6 +39,11 @@ IMPLEMENT_ASN1_FUNCTIONS(Authenticode_SpcIndirectDataContent)
void OpenSSL_free(void *ptr) {
OPENSSL_free(ptr);
}
+
+void SK_X509_free(stack_st_X509 *ptr) {
+ sk_X509_free(ptr);
+}
+
// clang-format on
} // namespace impl
@@ -252,7 +257,7 @@ std::vector<Certificate> SignedData::get_signers() const {
if (signers_stack_ptr == nullptr) {
return {};
}
- auto signers_stack = impl::STACK_OF_X509_ptr(signers_stack_ptr, sk_X509_free);
+ auto signers_stack = impl::STACK_OF_X509_ptr(signers_stack_ptr, impl::SK_X509_free);
std::vector<Certificate> signers;
for (auto i = 0; i < sk_X509_num(signers_stack.get()); ++i) {

View File

@@ -0,0 +1,27 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO trailofbits/uthenticode
REF v1.0.6
SHA512 6C9C4DD9E1FE7C329E10BC39E41927C8B82DD004275A88385C691AD85EF4079EBE2922083D5252019B8B25CC540F48E544B42B8178F256AE987D6B677713B063
HEAD_REF master
PATCHES
openssl.patch
)
# compatibility fix for newer versions of pe-parse
foreach(FILE IN ITEMS test/wincert-test.cpp test/signeddata-test.cpp test/uthenticode-test.cpp test/certificate-test.cpp src/include/uthenticode.h)
vcpkg_replace_string("${SOURCE_PATH}/${FILE}" "#include <parser-library/parse.h>" "#include <pe-parse/parse.h>")
endforeach()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/uthenticode)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

20
externals/vcpkg/ports/uthenticode/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,20 @@
{
"name": "uthenticode",
"version": "1.0.6",
"port-version": 2,
"description": "A cross-platform library for verifying Authenticode signatures",
"homepage": "https://github.com/trailofbits/uthenticode",
"supports": "!uwp",
"dependencies": [
"openssl",
"pe-parse",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}