summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-05-29 16:10:42 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-05-29 16:10:42 +0000
commit781ee797d4e37872fb3e4c1f8a43f22b22bcc6e3 (patch)
treea46e5095add35b411dc660b0d2e732cd1f621fd0
parent13c07b8cf71f59cbf95dc1c80a8a16fd3da7daca (diff)
Make i2d_ASN1_OBJECT() return -1 on error
This is what the (not quite appropriately) referenced ASN1_item_i2d() page documents for errors, matches what the RETURN VALUE section has been documenting for ages, matches BoringSSL, it's the usal behavior for i2d_*. It's also what OpenSSL (of course incorrectly) documents. discussed with jsing
-rw-r--r--lib/libcrypto/asn1/a_object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/asn1/a_object.c b/lib/libcrypto/asn1/a_object.c
index 00b5e7af92d..aae1b8bbd78 100644
--- a/lib/libcrypto/asn1/a_object.c
+++ b/lib/libcrypto/asn1/a_object.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a_object.c,v 1.52 2024/05/29 16:04:50 tb Exp $ */
+/* $OpenBSD: a_object.c,v 1.53 2024/05/29 16:10:41 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -619,7 +619,7 @@ i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
int objsize;
if (a == NULL || a->data == NULL)
- return 0;
+ return -1;
objsize = ASN1_object_size(0, a->length, V_ASN1_OBJECT);