diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2018-08-28 14:11:49 +0100 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2018-08-28 15:36:10 +0100 |
commit | e2f757a5c78fce69faeeacb0850b886374c63b5f (patch) | |
tree | 6fdf1962e358bc65ca7b9122f6a899b664d92199 /include/mupdf | |
parent | 1f279100b292519fa095c576e49ba3e3bb4efbe8 (diff) | |
download | mupdf-e2f757a5c78fce69faeeacb0850b886374c63b5f.tar.xz |
Avoid use of fixed size buffers for the digest when document signing
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.
Diffstat (limited to 'include/mupdf')
-rw-r--r-- | include/mupdf/pdf/document.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h index 9e9121df..7d2110b7 100644 --- a/include/mupdf/pdf/document.h +++ b/include/mupdf/pdf/document.h @@ -556,7 +556,10 @@ typedef pdf_pkcs7_designated_name *(pdf_pkcs7_designated_name_fn)(pdf_pkcs7_sign /* Free the resources associated with previously obtained designated name information */ typedef void (pdf_pkcs7_drop_designated_name_fn)(pdf_pkcs7_signer *signer, pdf_pkcs7_designated_name *name); -/* Create a signature based on ranges of bytes drawn from a steam */ +/* Predict the size of the digest. The actual digest returned by create_digest will be no greater in size */ +typedef int (pdf_pkcs7_max_digest_size_fn)(pdf_pkcs7_signer *signer); + +/* Create a signature based on ranges of bytes drawn from a stream */ typedef int (pdf_pkcs7_create_digest_fn)(pdf_pkcs7_signer *signer, fz_stream *in, unsigned char *digest, int *digest_len); struct pdf_pkcs7_signer_s @@ -565,6 +568,7 @@ struct pdf_pkcs7_signer_s pdf_pkcs7_drop_fn *drop; pdf_pkcs7_designated_name_fn *designated_name; pdf_pkcs7_drop_designated_name_fn *drop_designated_name; + pdf_pkcs7_max_digest_size_fn *max_digest_size; pdf_pkcs7_create_digest_fn *create_digest; }; |