From 329b1b07e4e2af1137d9739b8e2a25818790a51b Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 23 Dec 2021 18:04:41 +0000 Subject: [PATCH] Route templated implementations of {d2i,i2d}_ASN1_BOOLEAN() through ASN1_item_ex_{d2i,i2d}() instead of ASN1_item_{d2i,i2d}(). Fixes test failure on sparc64, and hopefully all other architectures. reported by tobhe with/ok jsing --- lib/libcrypto/asn1/tasn_typ.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/asn1/tasn_typ.c b/lib/libcrypto/asn1/tasn_typ.c index 060ea27fb9e..7a2b90f3908 100644 --- a/lib/libcrypto/asn1/tasn_typ.c +++ b/lib/libcrypto/asn1/tasn_typ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_typ.c,v 1.14 2021/12/13 17:56:15 jsing Exp $ */ +/* $OpenBSD: tasn_typ.c,v 1.15 2021/12/23 18:04:41 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -715,7 +715,8 @@ const ASN1_ITEM ASN1_BOOLEAN_it = { int i2d_ASN1_BOOLEAN(int a, unsigned char **out) { - return ASN1_item_i2d((ASN1_VALUE *)(long)(a), out, &ASN1_BOOLEAN_it); + return ASN1_item_ex_i2d((ASN1_VALUE **)(long *)(&a), out, + &ASN1_BOOLEAN_it, -1, 0); } int @@ -723,7 +724,8 @@ d2i_ASN1_BOOLEAN(int *a, const unsigned char **in, long len) { ASN1_BOOLEAN abool; - if (ASN1_item_d2i((ASN1_VALUE **)&abool, in, len, &ASN1_BOOLEAN_it) == NULL) + if (ASN1_item_ex_d2i((ASN1_VALUE **)&abool, in, len, &ASN1_BOOLEAN_it, + -1, 0, 0, NULL) <= 0) return -1; if (a != NULL) -- 2.20.1