aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdf_writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf_writer.c')
-rw-r--r--src/pdf_writer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pdf_writer.c b/src/pdf_writer.c
index be64e49..465d26b 100644
--- a/src/pdf_writer.c
+++ b/src/pdf_writer.c
@@ -5,11 +5,9 @@
*/
#include <stdlib.h>
-#include <string.h>
#include <time.h>
-#include <openssl/md5.h>
-
+#include "md5.h"
#include "pdf.h"
int
@@ -144,11 +142,11 @@ pdf_dump_trailer(pdf_object_t **pdf, FILE **fp, int xref)
buf_size = snprintf(buf, 64, "%lx%x", timestamp, size);
#endif
- unsigned char str[64];
- memcpy(str, buf, 64);
+ int fid_size;
+ unsigned char *fid;
- unsigned char fid[MD5_DIGEST_LENGTH];
- MD5(str, buf_size, fid);
+ if (strmd5(&fid, &fid_size, (unsigned char *) buf, buf_size) != 0)
+ return 1;
pdf_object_t *ptr = *pdf;
while (ptr->next != NULL)
@@ -172,7 +170,7 @@ pdf_dump_trailer(pdf_object_t **pdf, FILE **fp, int xref)
for (int i = 0; i < 2; i++) {
fputs("<", *fp);
- for (int j = 0; j < MD5_DIGEST_LENGTH; j++)
+ for (int j = 0; j < fid_size; j++)
fprintf(*fp, "%02x", fid[j]);
fputs(">", *fp);
@@ -191,5 +189,7 @@ pdf_dump_trailer(pdf_object_t **pdf, FILE **fp, int xref)
fputs("%%EOF\n", *fp);
+ free(fid);
+
return 0;
}