summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-11 01:18:20 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-11 01:18:20 +0000
commit6c078b56cfc97b0139056055ec76df3b8f79805b (patch)
tree7e67100d01a40adf17f58d4c0fd9f5308e2c3546
parentffec8218e26a8f115f5ce86d137308dd565868cd (diff)
import ASN1_TYPE_get(3) from OpenSSL,
deleting ASN1_TYPE_unpack_sequence() and ASN1_TYPE_pack_sequence() which we don't have
-rw-r--r--lib/libcrypto/man/ASN1_TYPE_get.3210
-rw-r--r--lib/libcrypto/man/Makefile4
2 files changed, 213 insertions, 1 deletions
diff --git a/lib/libcrypto/man/ASN1_TYPE_get.3 b/lib/libcrypto/man/ASN1_TYPE_get.3
new file mode 100644
index 00000000000..cb7f7150361
--- /dev/null
+++ b/lib/libcrypto/man/ASN1_TYPE_get.3
@@ -0,0 +1,210 @@
+.\" $OpenBSD: ASN1_TYPE_get.3,v 1.1 2016/11/11 01:18:19 schwarze Exp $
+.\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400
+.\"
+.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
+.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\"
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\"
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in
+.\" the documentation and/or other materials provided with the
+.\" distribution.
+.\"
+.\" 3. All advertising materials mentioning features or use of this
+.\" software must display the following acknowledgment:
+.\" "This product includes software developed by the OpenSSL Project
+.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+.\"
+.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+.\" endorse or promote products derived from this software without
+.\" prior written permission. For written permission, please contact
+.\" openssl-core@openssl.org.
+.\"
+.\" 5. Products derived from this software may not be called "OpenSSL"
+.\" nor may "OpenSSL" appear in their names without prior written
+.\" permission of the OpenSSL Project.
+.\"
+.\" 6. Redistributions of any form whatsoever must retain the following
+.\" acknowledgment:
+.\" "This product includes software developed by the OpenSSL Project
+.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+.\" OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd $Mdocdate: November 11 2016 $
+.Dt ASN1_TYPE_GET 3
+.Os
+.Sh NAME
+.Nm ASN1_TYPE_get ,
+.Nm ASN1_TYPE_set ,
+.Nm ASN1_TYPE_set1 ,
+.Nm ASN1_TYPE_cmp
+.Nd ASN1_TYPE utility functions
+.Sh SYNOPSIS
+.In openssl/asn1.h
+.Ft int
+.Fo ASN1_TYPE_get
+.Fa "ASN1_TYPE *a"
+.Fc
+.Ft void
+.Fo ASN1_TYPE_set
+.Fa "ASN1_TYPE *a"
+.Fa "int type"
+.Fa "void *value"
+.Fc
+.Ft int
+.Fo ASN1_TYPE_set1
+.Fa "ASN1_TYPE *a"
+.Fa "int type"
+.Fa "const void *value"
+.Fc
+.Ft int
+.Fo ASN1_TYPE_cmp
+.Fa "ASN1_TYPE *a"
+.Fa "ASN1_TYPE *b"
+.Fc
+.Sh DESCRIPTION
+These functions manipulate
+.Vt ASN1_TYPE
+structures.
+An
+.Vt ASN1_TYPE
+structure can contain any ASN.1 type or constructed type such as a
+SEQUENCE: it is effectively equivalent to the ASN.1 ANY type.
+.Pp
+.Fn ASN1_TYPE_get
+returns the type of
+.Fa a .
+.Pp
+.Fn ASN1_TYPE_set
+sets the value of
+.Fa a
+to
+.Fa type
+and
+.Fa value .
+This function uses the pointer
+.Fa value
+internally so it must
+.Sy not
+be freed up after the call.
+.Pp
+.Fn ASN1_TYPE_set1
+sets the value of
+.Fa a
+to
+.Fa type
+and a copy of
+.Fa value .
+.Pp
+.Fn ASN1_TYPE_cmp
+compares ASN.1 types
+.Fa a
+and
+.Fa b .
+.Pp
+The type and meaning of the
+.Fa value
+parameter for
+.Fn ASN1_TYPE_set
+and
+.Fn ASN1_TYPE_set1
+is determined by the
+.Fa type
+parameter.
+If
+.Fa type
+is
+.Dv V_ASN1_NULL ,
+.Fa value
+is ignored.
+If
+.Fa type
+is
+.Dv V_ASN1_BOOLEAN ,
+then the boolean is set to TRUE if
+.Fa value
+is not
+.Dv NULL .
+If
+.Fa type
+is
+.Dv V_ASN1_OBJECT ,
+then
+.Fa value
+is an
+.Vt ASN1_OBJECT
+structure.
+Otherwise
+.Fa type
+is an
+.Vt ASN1_STRING
+structure.
+If
+.Fa type
+corresponds to a primitive type or a string type, then the contents
+of the
+.Vt ASN1_STRING
+contains the content octets of the type.
+If
+.Fa type
+corresponds to a constructed type or a tagged type
+.Pq Dv V_ASN1_SEQUENCE , V_ASN1_SET , No or Dv V_ASN1_OTHER ,
+then the
+.Vt ASN1_STRING
+contains the entire ASN.1 encoding verbatim, including tag and
+length octets.
+.Pp
+.Fn ASN1_TYPE_cmp
+may not return zero if two types are equivalent but have different
+encodings.
+For example the single content octet of the boolean TRUE value under BER
+can have any non-zero encoding but
+.Fn ASN1_TYPE_cmp
+will only return zero if the values are the same.
+.Pp
+If either or both of the parameters passed to
+.Fn ASN1_TYPE_cmp
+is
+.Dv NULL ,
+the return value is non-zero.
+Technically, if both parameters are
+.Dv NULL ,
+the two types could be absent OPTIONAL fields and so should match,
+however passing
+.Dv NULL
+Values could also indicate a programming error (for example an
+unparseable type which returns
+.Dv NULL )
+for types which do
+.Sy not
+match.
+So applications should handle the case of two absent values separately.
+.Sh RETURN VALUES
+.Fn ASN1_TYPE_get
+returns the type of the
+.Vt ASN1_TYPE
+argument.
+.Pp
+.Fn ASN1_TYPE_set1
+returns 1 for success or 0 for failure.
+.Pp
+.Fn ASN1_TYPE_cmp
+returns 0 if the types are identical or non-zero otherwise.
diff --git a/lib/libcrypto/man/Makefile b/lib/libcrypto/man/Makefile
index 718bf91e610..07d736609bd 100644
--- a/lib/libcrypto/man/Makefile
+++ b/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.50 2016/11/05 20:36:11 schwarze Exp $
+# $OpenBSD: Makefile,v 1.51 2016/11/11 01:18:19 schwarze Exp $
.include <bsd.own.mk>
@@ -7,6 +7,8 @@ MAN= \
ASN1_STRING_length.3 \
ASN1_STRING_new.3 \
ASN1_STRING_print_ex.3 \
+ ASN1_TIME_set.3 \
+ ASN1_TYPE_get.3 \
ASN1_generate_nconf.3 \
ASN1_time_parse.3 \
BF_set_key.3 \