77 Commits

Author SHA1 Message Date
Romain Thomas
d29a74996b Process PKCS #9 counter signature and enhance signature verification 2021-01-16 09:44:51 +01:00
Romain Thomas
bdf1264df9 Update doc & tests 2021-01-16 09:44:51 +01:00
rthomas
634c2fc98e Enhance PE Authenticode 2021-01-16 09:44:51 +01:00
Romain Thomas
f4fc5784af Enhance CI & platforms 2021-01-03 17:52:44 +01:00
Romain Thomas
f8bd135057 Update dependencies 2020-12-23 07:37:39 +01:00
Romain Thomas
623055b045 Setup sccache 2020-12-12 08:31:52 +01:00
Kevin Warrick
d11149b03d Generate LIEFConfig and LIEFConfigVersion 2020-11-26 13:36:12 -05:00
rthomas
b224217bfe Remove cppcheck (to be replaced with clang-tidy) 2020-11-11 07:15:38 +01:00
rthomas
92181c8d51 Fix deps 2020-11-11 07:13:55 +01:00
rthomas
43a223b70f Package json.hpp into third-party directory 2020-11-10 17:52:34 +01:00
rthomas
24d89a1315 Lint 2020-11-10 17:21:28 +01:00
rthomas
1364f22c78 Improve logging interface 2020-11-09 21:02:50 +01:00
rafael-santiago
7b5e8503d6 Changing library artifact suffix...
...take into consideration CRT choice on MSVC based builds.
2020-11-05 09:37:16 -03:00
Tim Schwartz
5fed2461a9 Generates LIEF.pc and installs in /lib/pkgconfig/ 2020-08-26 08:16:21 -05:00
rthomas
5684960317 Update dependencies 2020-05-24 06:47:15 +02:00
Andrew
08d31be932 Authenticode-related bug fixes and improvements
Part of Authenticode verification consists of:
 - Comparing the computed Authenticode hash to the digest
   stored in the ContentInfo section
 - Comparing hash(ContentInfo) to the digest stored in the
   AuthenticatedAttributes section
 - Verifying signed(hash(AuthenticatedAttributes)) using a
   certificate identified by the issuer and serial number
   specified in the SignerInfo section

This commit makes it so that the raw bytes needed to
calculate hash(ContentInfo) and hash(AuthenticatedAttributes)
are available for use.

============================================================

Allow missing [0] in SpcSpOpusInfo

Some executables have MoreInfo but not a ProgramName (and the documentation
lists both as OPTIONAL), so handle this case correctly.

Example:

```
01416b1730218454c99b13592650cb170402b86742b4bab971565903b841829b

SEQUENCE(2 elem)
OBJECT IDENTIFIER1.3.6.1.4.1.311.2.1.12spcSpOpusInfo(Microsoft code signing)
SET(1 elem)
  SEQUENCE(1 elem)
  [1](1 elem)
   [0]http://www.mozilla.com
```

============================================================

Improve consistency of parsed serial numbers

When parsing the issuer serial number, call mbedtls_x509_get_serial instead of
parsing it as an integer directly with mbedtls_asn1_get_mpi. These two functions
differ in how they treat serial numbers prepended with '00' to prevent them from
being negative (the former preserves the '00', and the latter discards it). The
embedded certs are parsed via a call to mbedtls_x509_crt_parse_der, which uses
mbedtls_x509_get_serial behind the scenes, so there was an inconsistency between
lief_obj.signature.signer_info.issuer[1] and
lief_obj.signature.certificates[x].serial_number.  Example:

8bf57d97dd917c4f823659266caaa33e7398406daf11ba8318e3f7414ee3fb24

============================================================

Handle SpcLink and SpcString CHOICEs in SpcSpOpusInfo

The Authenticode spec doc says that these can be CHOICES, so
handle the easy ones and safely skip the others.

============================================================

Allow Authenticode sig to be parsed even if cert parsing fails

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Enable mbed TLS MD2 and MD4 support; add Unix debug options

By default, mbedtls doesn't support MD2 certs, which are fairly
common in older signed executables.  Ex:

1cb16f94cebdcad7dd05c8537375a6ff6379fcdb08528fc83889f26efaa84e2a

============================================================

Set MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION flag

Some older signed executables use certs with the SpcSpAgencyInfo
Critical Extension, which mbed TLS doesn't support, so set
MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to have it
skip this extension.  Example:

781ca31416ec708a587851dafd90c661b86f244ab8b8475c4185e958e54ff838

============================================================

Support accessing non-utf8 issuer names via Python

For a few signatures where the issuer name contained non-utf8
characters, accessing the issuer name field in Python would raise
a UnicodeDecodeError exception. Now this field is handled the
same way the names in the individual certs are (I'm not sure if
they get represented 100% correctly, but at least they are
consistent, which is good enough for me). Example:

048f91b9302c88380fc66adac1e314d82733089ef3a31eadca5f0cb4169b195f
2019-10-07 00:58:40 -04:00
Romain Thomas
f6cc8f8ff6 Improve debug build on Windows 2019-08-29 08:24:39 +02:00
Romain Thomas
d4ad532c58 Downgrade cmake_minimum_required to 3.5 2019-07-24 14:56:25 +02:00
Romain Thomas
8f2770506d Remove unecessary file 2019-07-08 08:14:20 +02:00
Romain Thomas
352fa954a1 Set LIEF_EXPORTS for LIEF shared library 2019-05-11 10:40:52 +02:00
Romain Thomas
6824548665 Bump version for nightly build
Issue: #294
2019-05-11 08:08:23 +02:00
Romain Thomas
27a03a6fd3 Force GLIBCXX_USE_CXX11_ABI 2019-05-04 07:17:03 +02:00
Romain Thomas
24f7898748 Add CMake export 2019-02-18 17:23:33 +01:00
Romain Thomas
38c7ef8416 Fix UTF8 char 2019-02-04 08:47:43 +01:00
Ray Donnelly
946527a732 MSVC: Add bigobj flag 2018-10-31 12:29:34 +00:00
Ray Donnelly
e7f5829b19 Allow building from released tarball 2018-10-31 12:29:01 +00:00
Adrien Guinet
89d4de54c8 Fix git tag commmand to always work
Forward CRT on other targets
2018-08-29 13:38:27 +02:00
Adrien Guinet
4b03ac45e0 Remove LIEF_SHARED_LIB from cmake
Moreover, add macros to force the CRT usage when using MSVC.
This is based on the LLVM one.
2018-08-29 08:50:56 +02:00
Romain Thomas
ce4af44b26 Disable ELPP crash handler 2018-07-16 08:57:54 +02:00
serge-sans-paille
f2f09d9c6d Do not distribute utf8 headers
They are part of the private interface, move them to the right place.
2018-06-15 15:08:44 +02:00
yd0b0N
e794ac1502 Add support for endianness 2018-05-15 11:38:56 +02:00
Romain Thomas
4ef1bb845f Add new formats: OAT, DEX, VDEX, ART 2018-05-04 12:46:28 +02:00
Zatherz
569dc591aa Windows compilation support (fix missing -lws2_32)
Provide `-DWINDOWS=1` to cmake to include necessary dependency ws2_32 in the build process.
2018-04-15 21:21:07 +02:00
Romain Thomas
70a18e8246 Merge branch 'pr/153' 2018-03-30 05:33:44 +02:00
Aure
04be950eab Add LIEF_SHARED_LIB option (default ON)
If LIEF_SHARED_LIB=off and LIEF_EXAMPLES=off and LIEF_PYTHON_API=off it works around bug #152 (Error compiling LIEF with VS2015 (fatal error C1001)) when calling the INSTALL build target
2018-03-30 05:32:59 +02:00
Romain Thomas
4ee01e5de5 Enable profiling 2018-03-28 07:29:05 +02:00
Romain Thomas
262af07311 Use Frozen for static const containers.
Thanks to https://github.com/serge-sans-paille/frozen

By default, Frozen is used if the compiler support C++14. It can be disabled by
using the "LIEF_DISABLE_FROZEN" option during the CMake configuration
step
2018-03-28 05:57:22 +02:00
Romain Thomas
3b17aba10e Refactor some parts of the Architecture:
* JSON visitor are located in the format namespace
  * Visitor are *real* visitor
  * Visitable class has been renamed to Object
  * Due to a bug in Visual Studio 2015, we move to VS2017
2018-03-13 16:49:02 +01:00
Romain Thomas
d26fdb41ec Use /MTd when Debug build
Fix: #147
2018-03-09 08:29:31 +01:00
Romain Thomas
251676a0a2 Hide 'is' and 'as' implementation 2018-03-07 12:52:12 +01:00
Romain Thomas
6b62777aa1 Enhance versioning with cmake 2018-01-18 16:47:01 +01:00
Romain Thomas
66b484938a Fix typo 2017-12-01 16:50:24 +01:00
Romain Thomas
24cc485038 Add JSON headers only if JSON module is enabled 2017-12-01 16:39:18 +01:00
Romain Thomas
b9c50dce34 WIP 2017-11-30 17:41:20 +01:00
illera88
93a4b2e2b2 Reorg so when LIEF_LOGGING=off easylogging++ does not get included at all 2017-11-22 09:02:52 +01:00
Romain Thomas
404e0ecca3 Enhance LIEF 'modules' separation 2017-11-18 18:07:14 +01:00
Romain Thomas
4cee3fa240 Some improvements in the CMake build
* cache dependencies in the 'third-party' directory.
  * Enhance Python 'find_library'
2017-11-01 10:12:05 +01:00
Romain Thomas
18d5b75d57 Bump to 0.8.3 2017-10-29 15:48:56 +01:00
Romain Thomas
3c713cf991 Bump to 0.8.2 2017-10-22 20:25:26 +02:00
Romain Thomas
f4e2ae0599 Bump to version 0.8.1 2017-10-18 14:48:52 +02:00