ports/security/netpgp/patches/patch-src_lib_signature_c

43 lines
1.3 KiB
Text

http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/pkgsrc/security/netpgp/patches/patch-src_lib_signature.c?rev=1.2&content-type=text/plain
Index: src/lib/signature.c
--- src/lib/signature.c.orig
+++ src/lib/signature.c
@@ -232,6 +232,7 @@ dsa_sign(pgp_hash_t *hash,
unsigned t;
uint8_t hashbuf[NETPGP_BUFSIZ];
DSA_SIG *dsasig;
+ const BIGNUM *r, *s;
/* hashsize must be "equal in size to the number of bits of q, */
/* the group generated by the DSA key's generator value */
@@ -252,8 +253,14 @@ dsa_sign(pgp_hash_t *hash,
dsasig = pgp_dsa_sign(hashbuf, hashsize, sdsa, dsa);
/* convert and write the sig out to memory */
- pgp_write_mpi(output, dsasig->r);
- pgp_write_mpi(output, dsasig->s);
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+ DSA_SIG_get0(dsasig, &r, &s);
+#else
+ r = dsasig->r;
+ s = dsasig->s;
+#endif
+ pgp_write_mpi(output, r);
+ pgp_write_mpi(output, s);
DSA_SIG_free(dsasig);
return 1;
}
@@ -903,7 +910,11 @@ open_output_file(pgp_output_t **output,
/* setup output file */
if (outname) {
- fd = pgp_setup_file_write(output, outname, overwrite);
+ if (strcmp(outname, "-") == 0) {
+ fd = pgp_setup_file_write(output, NULL, overwrite);
+ } else {
+ fd = pgp_setup_file_write(output, outname, overwrite);
+ }
} else {
unsigned flen = (unsigned)(strlen(inname) + 4 + 1);
char *f = NULL;