aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2019-02-18 20:59:10 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2019-02-18 20:59:10 -0800
commit7818dc9c76ef1a007aa725286b8113b2341ebc11 (patch)
tree96b36933925f99b95f53853832ecae3056eb3d7f
parent7b048e81b44e9bfa427bb97cfbd6b1aa7c078ff1 (diff)
downloadldid-7818dc9c76ef1a007aa725286b8113b2341ebc11.tar.gz
ldid-7818dc9c76ef1a007aa725286b8113b2341ebc11.tar.zst
ldid-7818dc9c76ef1a007aa725286b8113b2341ebc11.zip
Port hash agility support to use OpenSSL 0.9.x :D.
-rw-r--r--ldid.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/ldid.cpp b/ldid.cpp
index 7d933b6..6d03d1b 100644
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -1583,8 +1583,12 @@ class Signature {
for (unsigned i(0), e(sk_X509_num(certs)); i != e; i++)
_assert(PKCS7_add_certificate(value_, sk_X509_value(certs, e - i - 1)));
- auto info(PKCS7_sign_add_signer(value_, stuff, stuff, NULL, PKCS7_NOSMIMECAP));
+ // XXX: this is the same as PKCS7_sign_add_signer(value_, stuff, stuff, NULL, PKCS7_NOSMIMECAP)
+ _assert(X509_check_private_key(stuff, stuff));
+ auto info(PKCS7_add_signature(value_, stuff, stuff, EVP_sha1()));
_assert(info != NULL);
+ _assert(PKCS7_add_certificate(value_, stuff));
+ _assert(PKCS7_add_signed_attribute(info, NID_pkcs9_contentType, V_ASN1_OBJECT, OBJ_nid2obj(NID_pkcs7_data)));
PKCS7_set_detached(value_, 1);
@@ -1600,7 +1604,13 @@ class Signature {
throw;
}
- _assert(PKCS7_final(value_, data, PKCS7_BINARY));
+ // XXX: this is the same as PKCS7_final(value_, data, PKCS7_BINARY)
+ BIO *bio(PKCS7_dataInit(value_, NULL));
+ _assert(bio != NULL);
+ _scope({ BIO_free_all(bio); });
+ SMIME_crlf_copy(data, bio, PKCS7_BINARY);
+ BIO_flush(bio);
+ _assert(PKCS7_dataFinal(value_, bio));
}
~Signature() {