From f2ecd8d86ead590b4799f8a54e96e11384df2b3b Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 7 Oct 2018 21:27:40 +0000 Subject: Fix a bug in inline PS code handling (S. Hirata) git-svn-id: svn://tug.org/texlive/trunk@48853 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/pdfencrypt.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'Build/source/texk/dvipdfm-x/pdfencrypt.c') diff --git a/Build/source/texk/dvipdfm-x/pdfencrypt.c b/Build/source/texk/dvipdfm-x/pdfencrypt.c index 7a7f7bff63c..229d7d554ac 100644 --- a/Build/source/texk/dvipdfm-x/pdfencrypt.c +++ b/Build/source/texk/dvipdfm-x/pdfencrypt.c @@ -98,13 +98,13 @@ pdf_enc_compute_id_string (const char *producer, MD5_init(&md5); /* Don't use timezone for compatibility */ dpx_util_format_asn_date(datestr, 0); - MD5_write(&md5, (unsigned char *)datestr, strlen(datestr)); + MD5_write(&md5, (const unsigned char *)datestr, strlen(datestr)); if (producer) - MD5_write(&md5, (unsigned char *)producer, strlen(producer)); + MD5_write(&md5, (const unsigned char *)producer, strlen(producer)); if (dviname) - MD5_write(&md5, (unsigned char *)dviname, strlen(dviname)); + MD5_write(&md5, (const unsigned char *)dviname, strlen(dviname)); if (pdfname) - MD5_write(&md5, (unsigned char *)pdfname, strlen(pdfname)); + MD5_write(&md5, (const unsigned char *)pdfname, strlen(pdfname)); MD5_final(p->ID, &md5); } @@ -284,17 +284,20 @@ compute_hash_V5 (unsigned char *hash, const unsigned char *salt, const unsigned char *user_key, int R /* revision */) { - SHA256_CONTEXT sha; unsigned char K[64]; size_t K_len; int nround; - SHA256_init (&sha); - SHA256_write(&sha, (const unsigned char *)passwd, strlen(passwd)); - SHA256_write(&sha, salt, 8); - if (user_key) - SHA256_write(&sha, user_key, 48); - SHA256_final(hash, &sha); + { + SHA256_CONTEXT sha; + + SHA256_init (&sha); + SHA256_write(&sha, (const unsigned char *)passwd, strlen(passwd)); + SHA256_write(&sha, salt, 8); + if (user_key) + SHA256_write(&sha, user_key, 48); + SHA256_final(hash, &sha); + } ASSERT( R ==5 || R == 6 ); -- cgit v1.2.3