Line 0
Link Here
|
|
|
1 |
--- zxsig.c.orig 2016-02-29 00:16:50 UTC |
2 |
+++ zxsig.c |
3 |
@@ -887,8 +887,13 @@ int zx_report_openssl_err(const char* lo |
4 |
#endif |
5 |
|
6 |
D("%s: len=%d data(%.*s)", lk, len, len, data); |
7 |
+#if __FreeBSD__ |
8 |
+ D("%s: data above %d", lk, hexdump_zxid("data: ", data, data+len, 4096)); |
9 |
+ D("%s: digest above %d", lk, hexdump_zxid("digest: ", mdbuf, mdbuf+mdlen, 64)); |
10 |
+#else |
11 |
D("%s: data above %d", lk, hexdump("data: ", data, data+len, 4096)); |
12 |
D("%s: digest above %d", lk, hexdump("digest: ", mdbuf, mdbuf+mdlen, 64)); |
13 |
+#endif |
14 |
|
15 |
if (!priv_key) { |
16 |
ERR(priv_key_missing_msg, geteuid(), getegid()); |
17 |
@@ -906,7 +911,11 @@ int zx_report_openssl_err(const char* lo |
18 |
if (RSA_sign(EVP_MD_type(evp_digest), mdbuf, mdlen, (unsigned char*)*sig, (unsigned int*)&len, rsa)) { |
19 |
DD("data = %s, SHA1 sig = %s, siglen = %d", data, *sig, len); |
20 |
D("RSA siglen = %d", len); |
21 |
+#if __FreeBSD__ |
22 |
+ D("%s: sig above %d", lk, hexdump_zxid("sig: ", *sig, *sig+len, 1024)); |
23 |
+#else |
24 |
D("%s: sig above %d", lk, hexdump("sig: ", *sig, *sig+len, 1024)); |
25 |
+#endif |
26 |
return len; |
27 |
} |
28 |
#else |
29 |
@@ -1042,9 +1051,15 @@ int zxsig_verify_data(int len, char* dat |
30 |
else if (!strcmp(mdalg, "SHA512")) { SHA512((unsigned char*)data, len, mdbuf); nid = NID_sha512; } |
31 |
else { SHA1((unsigned char*)data, len, mdbuf); nid = NID_sha1; } |
32 |
#endif |
33 |
+#if __FreeBSD__ |
34 |
+ D("%s: vfy data len=%d above %d", lk, len, hexdump_zxid("data: ", data, data+len, 8192)); |
35 |
+ D("%s: vfy sig above %d", lk, hexdump_zxid("sig: ", sig, sig+siglen, 8192)); |
36 |
+ D("%s: vfy md above %d", lk, hexdump_zxid("md: ", mdbuf, mdbuf+64, 64)); |
37 |
+#else |
38 |
D("%s: vfy data len=%d above %d", lk, len, hexdump("data: ", data, data+len, 8192)); |
39 |
D("%s: vfy sig above %d", lk, hexdump("sig: ", sig, sig+siglen, 8192)); |
40 |
D("%s: vfy md above %d", lk, hexdump("md: ", mdbuf, mdbuf+64, 64)); |
41 |
+#endif |
42 |
|
43 |
evp_pubk = X509_get_pubkey(cert); |
44 |
if (!evp_pubk) { |
45 |
@@ -1080,7 +1095,11 @@ int zxsig_verify_data(int len, char* dat |
46 |
if (!verdict) { |
47 |
ERR("RSA signature verify in %s data failed. Perhaps you have bad or no certificate(%p) len=%d data=%p siglen=%d sig=%p", lk, cert, len, data, siglen, sig); |
48 |
zx_report_openssl_err(lk); |
49 |
+#if __FreeBSD__ |
50 |
+ D("RSA_vfy(%s) bad sig above %d", lk, hexdump_zxid("sig: ", sig, sig+siglen, 4096)); |
51 |
+#else |
52 |
D("RSA_vfy(%s) bad sig above %d", lk, hexdump("sig: ", sig, sig+siglen, 4096)); |
53 |
+#endif |
54 |
return ZXSIG_VFY_FAIL; |
55 |
} else { |
56 |
D("RSA verify OK %d", verdict); |
57 |
@@ -1115,7 +1134,11 @@ int zxsig_verify_data(int len, char* dat |
58 |
if (!verdict) { |
59 |
ERR("DSA signature verify in %s data failed. Perhaps you have bad or no certificate(%p) len=%d data=%p siglen=%d sig=%p", lk, cert, len, data, siglen, sig); |
60 |
zx_report_openssl_err(lk); |
61 |
+#if __FreeBSD__ |
62 |
+ D("DSA_vfy(%s) sig above %d", lk, hexdump_zxid("sig: ", sig, sig+siglen, 4096)); |
63 |
+#else |
64 |
D("DSA_vfy(%s) sig above %d", lk, hexdump("sig: ", sig, sig+siglen, 4096)); |
65 |
+#endif |
66 |
return ZXSIG_VFY_FAIL; |
67 |
} else { |
68 |
D("DSA verify OK %d", verdict); |
69 |
|