summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ts/ts_rsp_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ts/ts_rsp_sign.c')
-rw-r--r--src/lib/libcrypto/ts/ts_rsp_sign.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ts/ts_rsp_sign.c b/src/lib/libcrypto/ts/ts_rsp_sign.c
index 828407aa4b..cbd7039abe 100644
--- a/src/lib/libcrypto/ts/ts_rsp_sign.c
+++ b/src/lib/libcrypto/ts/ts_rsp_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_rsp_sign.c,v 1.24 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: ts_rsp_sign.c,v 1.25 2021/11/04 23:52:34 beck Exp $ */
2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL 2/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
3 * project 2002. 3 * project 2002.
4 */ 4 */
@@ -849,14 +849,18 @@ ESS_CERT_ID_new_init(X509 *cert, int issuer_needed)
849{ 849{
850 ESS_CERT_ID *cid = NULL; 850 ESS_CERT_ID *cid = NULL;
851 GENERAL_NAME *name = NULL; 851 GENERAL_NAME *name = NULL;
852 unsigned char cert_hash[TS_HASH_LEN];
852 853
853 /* Recompute SHA1 hash of certificate if necessary (side effect). */ 854 /* Recompute SHA1 hash of certificate if necessary (side effect). */
854 X509_check_purpose(cert, -1, 0); 855 X509_check_purpose(cert, -1, 0);
855 856
856 if (!(cid = ESS_CERT_ID_new())) 857 if (!(cid = ESS_CERT_ID_new()))
857 goto err; 858 goto err;
858 if (!ASN1_OCTET_STRING_set(cid->hash, cert->sha1_hash, 859
859 sizeof(cert->sha1_hash))) 860 if (!X509_digest(cert, TS_HASH_EVP, cert_hash, NULL))
861 goto err;
862
863 if (!ASN1_OCTET_STRING_set(cid->hash, cert_hash, sizeof(cert_hash)))
860 goto err; 864 goto err;
861 865
862 /* Setting the issuer/serial if requested. */ 866 /* Setting the issuer/serial if requested. */