summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ts/ts_asn1.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/ts/ts_asn1.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/ts/ts_asn1.c')
-rw-r--r--src/lib/libcrypto/ts/ts_asn1.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ts/ts_asn1.c b/src/lib/libcrypto/ts/ts_asn1.c
index 49232d8073..bc89f1368a 100644
--- a/src/lib/libcrypto/ts/ts_asn1.c
+++ b/src/lib/libcrypto/ts/ts_asn1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ts_asn1.c,v 1.10 2016/11/04 18:35:30 jsing Exp $ */ 1/* $OpenBSD: ts_asn1.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
2/* Written by Nils Larsch for the OpenSSL project 2004. 2/* Written by Nils Larsch for the OpenSSL project 2004.
3 */ 3 */
4/* ==================================================================== 4/* ====================================================================
@@ -541,19 +541,18 @@ ts_resp_set_tst_info(TS_RESP *a)
541 541
542 if (a->token) { 542 if (a->token) {
543 if (status != 0 && status != 1) { 543 if (status != 0 && status != 1) {
544 TSerr(TS_F_TS_RESP_SET_TST_INFO, TS_R_TOKEN_PRESENT); 544 TSerror(TS_R_TOKEN_PRESENT);
545 return 0; 545 return 0;
546 } 546 }
547 if (a->tst_info != NULL) 547 if (a->tst_info != NULL)
548 TS_TST_INFO_free(a->tst_info); 548 TS_TST_INFO_free(a->tst_info);
549 a->tst_info = PKCS7_to_TS_TST_INFO(a->token); 549 a->tst_info = PKCS7_to_TS_TST_INFO(a->token);
550 if (!a->tst_info) { 550 if (!a->tst_info) {
551 TSerr(TS_F_TS_RESP_SET_TST_INFO, 551 TSerror(TS_R_PKCS7_TO_TS_TST_INFO_FAILED);
552 TS_R_PKCS7_TO_TS_TST_INFO_FAILED);
553 return 0; 552 return 0;
554 } 553 }
555 } else if (status == 0 || status == 1) { 554 } else if (status == 0 || status == 1) {
556 TSerr(TS_F_TS_RESP_SET_TST_INFO, TS_R_TOKEN_NOT_PRESENT); 555 TSerror(TS_R_TOKEN_NOT_PRESENT);
557 return 0; 556 return 0;
558 } 557 }
559 558
@@ -858,13 +857,13 @@ PKCS7_to_TS_TST_INFO(PKCS7 *token)
858 const unsigned char *p; 857 const unsigned char *p;
859 858
860 if (!PKCS7_type_is_signed(token)) { 859 if (!PKCS7_type_is_signed(token)) {
861 TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_PKCS7_TYPE); 860 TSerror(TS_R_BAD_PKCS7_TYPE);
862 return NULL; 861 return NULL;
863 } 862 }
864 863
865 /* Content must be present. */ 864 /* Content must be present. */
866 if (PKCS7_get_detached(token)) { 865 if (PKCS7_get_detached(token)) {
867 TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_DETACHED_CONTENT); 866 TSerror(TS_R_DETACHED_CONTENT);
868 return NULL; 867 return NULL;
869 } 868 }
870 869
@@ -872,14 +871,14 @@ PKCS7_to_TS_TST_INFO(PKCS7 *token)
872 pkcs7_signed = token->d.sign; 871 pkcs7_signed = token->d.sign;
873 enveloped = pkcs7_signed->contents; 872 enveloped = pkcs7_signed->contents;
874 if (OBJ_obj2nid(enveloped->type) != NID_id_smime_ct_TSTInfo) { 873 if (OBJ_obj2nid(enveloped->type) != NID_id_smime_ct_TSTInfo) {
875 TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_PKCS7_TYPE); 874 TSerror(TS_R_BAD_PKCS7_TYPE);
876 return NULL; 875 return NULL;
877 } 876 }
878 877
879 /* We have a DER encoded TST_INFO as the signed data. */ 878 /* We have a DER encoded TST_INFO as the signed data. */
880 tst_info_wrapper = enveloped->d.other; 879 tst_info_wrapper = enveloped->d.other;
881 if (tst_info_wrapper->type != V_ASN1_OCTET_STRING) { 880 if (tst_info_wrapper->type != V_ASN1_OCTET_STRING) {
882 TSerr(TS_F_PKCS7_TO_TS_TST_INFO, TS_R_BAD_TYPE); 881 TSerror(TS_R_BAD_TYPE);
883 return NULL; 882 return NULL;
884 } 883 }
885 884