summaryrefslogtreecommitdiff
path: root/source/helpers
AgeCommit message (Collapse)Author
2018-08-28Avoid use of fixed size buffers for the digest when document signingPaul Gardiner
The signer object now has an extra method that informs the caller of the maximum size the digest might be. This is used to allocate space for the digest within the file and to size some of the buffers used in the code. The openssl-based inplementation of the signer object has been updated to perform a test digest generation so as to find the size needed. We believe that the digest size is indendent of the hashed data.
2018-08-10Use stubs instead of conditional compile with HAVE_LIBCRYPTO.Tor Andersson
The macro is only set when building the pkcs7-helper library, so cannot be used by client code. Build stub functions when compiling the pkcs7-openssl helper library without libcrypto.
2018-07-06Fix muraster and mu-office-lib.Robin Watts
These got broken during the fz_rect/fz_matrix pass-by-value changes.
2018-07-06Fix bad error handling in pdf_pkcs7_openssl_read_pfx.Paul Gardiner
Failure within this function could lead to segfaults in drop_signer. The problem was early allocation of the signer struct without setting its drop method, so that on error signer was non-null, but not in a state where drop_signer could be called.
2018-02-06Include limits.h where INT_MAX/INT_MIN/PATH_MAX/UINT_MAX are used.Sebastian Rasmussen
2018-02-02Signature support: add a null pdf_check_signature functionPaul Gardiner
Add a version of pdf_check_signature function that reports no support, for builds without openssl. This allows the removal of ifdefs from the apps.
2018-02-02Signature support: code-style and typo fixesPaul Gardiner
2018-02-02Signature support: decouple mupdf from the pkcs7 implementationPaul Gardiner
The mupdf build included an implimentation of the pkcs7 functions that are needed for signing documents and verifying signatures, the implementation being either an openssl-based one, or a stub that returned errors. This commit removes the pkcs7 functions from the main mupdf library. For the sake of verification, there wasn't really a need for the pkcs7 functions to be part of mupdf. It was only the checking function that used them. The checking function is now provided as a helper, outside of the main build. The openssl-based pkcs7 functions area also supplied as a helper. Users wishing to verify signatures can either use the checking function directly, or use the source on which to base their own. Document signing requires more integration between mupdf and pkcs7 because part of the process is performed at time of signing and part when saving the document. Mupdf already had a pdf_pkcs7_signer object that kept information between the two phases. That object has now been extended to include the pkcs7 functions involved in signing, and the signing function now requires such an object, rather than a file path to a certificate. The openssl-based pkcs7 helper provides a function that, given the path to a certificate, will return a pdf_pkcs7_signer object. The intention is that different implementations can be produced for different platforms, based on cryptographic routines built into the operationg system. In each case, for the sake of document signing, the routines would be wrapped up as a pdf_pkcs7_signer object.
2017-11-09Avoid mu-office-lib calling fz_lock.Robin Watts
It was only ever calling fz_lock for its own lock. This was an abuse at best, and could potentially have caused trouble with the deadlock detection code. Instead, lock the same lock, but do so using custom (static) functions.
2017-11-01Use int64_t for public file API offsets.Tor Andersson
Don't mess with conditional compilation with LARGEFILE -- always expose 64-bit file offsets in our public API.
2017-07-19Add spots to fz_pixmaps.Robin Watts
Update separations interface further to cope with whether spots should be rendered separately, or as composite colors.
2017-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-01-17Fix typos.Sebastian Rasmussen
2016-12-27Strip extraneous blank lines.Tor Andersson
2016-12-19Add MuOfficeLib functions to safely run native MuPDF ops.Robin Watts
It seems likely that we'll want people to able to use the MuPDF C API as well as the MuOfficeLib helper lib. We therefore need a way to get fz_context and fz_document values out of MuOfficeLib. Potential problems exist with people calling MuPDF C API functions using an fz_context that is in use elsewhere. Similarly, if an fz_document is in use in a background thread (for instance in a page render), we need to ensure that it can't be used at the same time elsewhere. We therefore provide MuOffice{Lib,Doc,Page}_run functions that allow this to happen safely. This largely insulates callers from the complexities of having to clone contexts etc, it safely ensures that exceptions cannot be propogated beyond the topmost fz_try/ fz_catch, and it ensures that appropriate locking is used.
2016-12-19mu-threads: Fix windows thread and semaphore creationRobin Watts
Was returning errors on successful creation.
2016-12-19mu-office-lib: Move threads out of statics.Robin Watts
Avoid using statics to hold the mutexes. This is safer for multiple-instantiation.
2016-12-19mu-threads: Fix Windows mu_destroy_threadRobin Watts
When destroying a thread, set the thread handle to NULL so we know that subsequent calls shouldn't try to destroy it again.
2016-11-23Fix mu-threads build on linux.Tor Andersson
2016-11-23First version of mu-office-lib.Robin Watts
2016-11-23Move threading macros out into a mu-threads helper file.Robin Watts