From e8d2363fadeecf65999ef22935b3c2b5bb2097c7 Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 22 Nov 2021 14:00:27 +0000 Subject: [PATCH] new manual page a2d_ASN1_OBJECT(3); while here, add a few STANDARDS references --- lib/libcrypto/man/ASN1_OBJECT_new.3 | 13 ++++- lib/libcrypto/man/Makefile | 3 +- lib/libcrypto/man/a2d_ASN1_OBJECT.3 | 83 +++++++++++++++++++++++++++++ lib/libcrypto/man/d2i_ASN1_OBJECT.3 | 11 +++- 4 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 lib/libcrypto/man/a2d_ASN1_OBJECT.3 diff --git a/lib/libcrypto/man/ASN1_OBJECT_new.3 b/lib/libcrypto/man/ASN1_OBJECT_new.3 index 671631094b2..ff98f2491a7 100644 --- a/lib/libcrypto/man/ASN1_OBJECT_new.3 +++ b/lib/libcrypto/man/ASN1_OBJECT_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.12 2021/11/22 12:06:51 schwarze Exp $ +.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.13 2021/11/22 14:00:27 schwarze Exp $ .\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 .\" .\" This file is a derived work. @@ -179,9 +179,20 @@ the following diagnostic can be retrieved in addition to the above: Memory allocation failed. .El .Sh SEE ALSO +.Xr a2d_ASN1_OBJECT 3 , .Xr ASN1_TYPE_get 3 , .Xr d2i_ASN1_OBJECT 3 , .Xr OBJ_nid2obj 3 +.Sh STANDARDS +ITU-T Recommendation X.208, also known as ISO/IEC 8824-1: +Specification of Abstract Syntax Notation One (ASN.1), +section 28: Notation for the object identifier type +.Pp +ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: +Information technology - ASN.1 encoding rules: +Specification of Basic Encoding Rules (BER), Canonical Encoding +Rules (CER) and Distinguished Encoding Rules (DER), +section 8.19: Encoding of an object identifier value .Sh HISTORY .Fn ASN1_OBJECT_new and diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile index 10f841bd8d7..4a8536747f4 100644 --- a/lib/libcrypto/man/Makefile +++ b/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.218 2021/11/21 15:11:01 schwarze Exp $ +# $OpenBSD: Makefile,v 1.219 2021/11/22 14:00:27 schwarze Exp $ .include @@ -367,6 +367,7 @@ MAN= \ X509at_add1_attr.3 \ X509at_get_attr.3 \ X509v3_get_ext_by_NID.3 \ + a2d_ASN1_OBJECT.3 \ crypto.3 \ d2i_ASN1_BOOLEAN.3 \ d2i_ASN1_NULL.3 \ diff --git a/lib/libcrypto/man/a2d_ASN1_OBJECT.3 b/lib/libcrypto/man/a2d_ASN1_OBJECT.3 new file mode 100644 index 00000000000..8cf6489614a --- /dev/null +++ b/lib/libcrypto/man/a2d_ASN1_OBJECT.3 @@ -0,0 +1,83 @@ +.\" $OpenBSD: a2d_ASN1_OBJECT.3,v 1.1 2021/11/22 14:00:27 schwarze Exp $ +.\" +.\" Copyright (c) 2021 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: November 22 2021 $ +.Dt A2D_ASN1_OBJECT 3 +.Os +.Sh NAME +.Nm a2d_ASN1_OBJECT +.Nd DER content octets of an ASN.1 object identifier +.Sh SYNOPSIS +.Ft int +.Fo a2d_ASN1_OBJECT +.Fa "unsigned char *der_out" +.Fa "int olen" +.Fa "const char *val_in" +.Fa "int ilen" +.Fc +.Sh DESCRIPTION +.Fn a2d_ASN1_OBJECT +accepts an ASCII string +.Fa val_in +of +.Fa ilen +bytes and interprets it as the numerical form of an ASN.1 object identifier. +It writes the content octets of the DER encoding of the object identifier +to the buffer +.Fa der_out +which is +.Fa olen +bytes long. +The identifier and length octets of the DER encoding are not written. +.Pp +If +.Fa ilen +is \-1, the +.Xr strlen 3 +of +.Fa val_in +is used instead. +.Pp +If +.Fa der_out +is a +.Dv NULL +pointer, writing the content objects is skipped +and only the return value is calculated. +.Sh RETURN VALUES +.Fn a2d_ASN1_OBJECT +returns the number of content octets that were or would be written or 0 if +.Fa ilen +is 0, if +.Fa val_in +is not a valid representation of an object identfier, +if memory allocation fails, or if the number of content octets +would be larger than +.Fa olen . +.Sh SEE ALSO +.Xr ASN1_OBJECT_new 3 , +.Xr i2d_ASN1_OBJECT 3 , +.Xr OBJ_create 3 +.Sh STANDARDS +ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: +Information technology - ASN.1 encoding rules: +Specification of Basic Encoding Rules (BER), Canonical Encoding +Rules (CER) and Distinguished Encoding Rules (DER), +section 8.19: Encoding of an object identifier value +.Sh HISTORY +.Fn a2d_ASN1_OBJECT +first appeared in SSLeay 0.8.0 and has been available since +.Ox 2.4 . diff --git a/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/lib/libcrypto/man/d2i_ASN1_OBJECT.3 index 09a17ced7cf..bcd7e187916 100644 --- a/lib/libcrypto/man/d2i_ASN1_OBJECT.3 +++ b/lib/libcrypto/man/d2i_ASN1_OBJECT.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.9 2018/04/25 15:17:52 schwarze Exp $ +.\" $OpenBSD: d2i_ASN1_OBJECT.3,v 1.10 2021/11/22 14:00:27 schwarze Exp $ .\" OpenSSL 05ea606a May 20 20:52:46 2016 -0400 .\" .\" Copyright (c) 2017 Ingo Schwarze @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 25 2018 $ +.Dd $Mdocdate: November 22 2021 $ .Dt D2I_ASN1_OBJECT 3 .Os .Sh NAME @@ -71,9 +71,16 @@ if an error occurs. returns the number of bytes successfully encoded or a value <= 0 if an error occurs. .Sh SEE ALSO +.Xr a2d_ASN1_OBJECT 3 , .Xr ASN1_item_d2i 3 , .Xr ASN1_OBJECT_new 3 , .Xr OBJ_nid2obj 3 +.Sh STANDARDS +ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: +Information technology - ASN.1 encoding rules: +Specification of Basic Encoding Rules (BER), Canonical Encoding +Rules (CER) and Distinguished Encoding Rules (DER), +section 8.19: Encoding of an object identifier value .Sh HISTORY .Fn d2i_ASN1_OBJECT and -- 2.20.1