summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2011-03-09 11:39:43 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2011-03-09 11:39:43 +0000
commitf97c17bf8bf8b0998c128160616349d7cfcdec4b (patch)
tree6aed4af215e49b095a02ffc190c03a8ad02891ee /Build/source
parent1071259eb3244975c44f54d1f3314637ef5a72c8 (diff)
use compute_id_string like dvipdfmx as much as possible.
git-svn-id: svn://tug.org/texlive/trunk@21661 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/xdvipdfmx/ChangeLog.TL6
-rw-r--r--Build/source/texk/xdvipdfmx/src/dvipdfmx.c1
-rw-r--r--Build/source/texk/xdvipdfmx/src/pdfencrypt.c30
-rw-r--r--Build/source/texk/xdvipdfmx/src/pdfencrypt.h1
4 files changed, 38 insertions, 0 deletions
diff --git a/Build/source/texk/xdvipdfmx/ChangeLog.TL b/Build/source/texk/xdvipdfmx/ChangeLog.TL
index 4354565afec..f334840ce4c 100644
--- a/Build/source/texk/xdvipdfmx/ChangeLog.TL
+++ b/Build/source/texk/xdvipdfmx/ChangeLog.TL
@@ -1,6 +1,12 @@
ChangeLog.TL: TeX Live (TL) changes for xdvipdfmx
=================================================
+2011-03-09 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ * src/dvipdfmx.c, src/pdfencrypt.c and src/pdfencrypt.h:
+ recover compute_id_string() for the consistency with dvipdfmx
+ as much as possible.
+
2011-03-09 Peter Breitenlohner <peb@mppmu.mpg.de>
* configure.ac: Check for <sys/wait.h>, drop check for system().
diff --git a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
index 6e0431b7791..8401fcbd863 100644
--- a/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
+++ b/Build/source/texk/xdvipdfmx/src/dvipdfmx.c
@@ -858,6 +858,7 @@ main (int argc, char *argv[])
if (pdf_filename == NULL && dvi_filename != NULL)
set_default_pdf_filename();
+ compute_id_string (dvi_filename, pdf_filename);
if (do_encryption) {
pdf_enc_set_passwd(key_bits, permission, NULL, NULL);
if (key_bits > 40 && pdf_get_version() < 4)
diff --git a/Build/source/texk/xdvipdfmx/src/pdfencrypt.c b/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
index 7ce6c084764..3f0cb4fcdfc 100644
--- a/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
+++ b/Build/source/texk/xdvipdfmx/src/pdfencrypt.c
@@ -78,6 +78,36 @@ void pdf_enc_set_verbose (void)
if (verbose < 255) verbose++;
}
+#define PRODUCER "%s-%s, Copyright \251 2002-2010 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata"
+void compute_id_string (char *dviname, char *pdfname)
+{
+ char *date_string, *producer;
+ time_t current_time;
+ struct tm *bd_time;
+
+ MD5_init(&md5_ctx);
+
+ date_string = NEW (15, char);
+ time(&current_time);
+ bd_time = localtime(&current_time);
+ sprintf (date_string, "%04d%02d%02d%02d%02d%02d",
+ bd_time -> tm_year+1900, bd_time -> tm_mon+1, bd_time -> tm_mday,
+ bd_time -> tm_hour, bd_time -> tm_min, bd_time -> tm_sec);
+ MD5_write(&md5_ctx, (unsigned char *)date_string, strlen(date_string));
+ RELEASE (date_string);
+
+ producer = NEW (strlen(PRODUCER)+strlen(PACKAGE)+strlen(VERSION), char);
+ sprintf(producer, PRODUCER, PACKAGE, VERSION);
+ MD5_write(&md5_ctx, (unsigned char *)producer, strlen(producer));
+ RELEASE (producer);
+
+ if (dviname)
+ MD5_write(&md5_ctx, (unsigned char *)dviname, strlen(dviname));
+ if (pdfname)
+ MD5_write(&md5_ctx, (unsigned char *)pdfname, strlen(pdfname));
+ MD5_final(id_string, &md5_ctx);
+}
+
static void passwd_padding (unsigned char *src, unsigned char *dst)
{
register int len = strlen((char *)src);
diff --git a/Build/source/texk/xdvipdfmx/src/pdfencrypt.h b/Build/source/texk/xdvipdfmx/src/pdfencrypt.h
index 8b4d536b323..87ede2cd974 100644
--- a/Build/source/texk/xdvipdfmx/src/pdfencrypt.h
+++ b/Build/source/texk/xdvipdfmx/src/pdfencrypt.h
@@ -29,6 +29,7 @@
extern void pdf_enc_set_verbose (void);
extern pdf_obj *pdf_enc_id_array (void);
+extern void compute_id_string (char *dviname, char *pdfname);
extern void pdf_enc_set_label (unsigned long label);
extern void pdf_enc_set_generation (unsigned generation);
extern void pdf_enc_set_passwd (unsigned size, unsigned perm, const char *owner, const char *user);