1.\" $OpenBSD: d2i_ASN1_NULL.3,v 1.4 2021/11/22 16:19:54 schwarze Exp $ 2.\" 3.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: November 22 2021 $ 18.Dt D2I_ASN1_NULL 3 19.Os 20.Sh NAME 21.Nm d2i_ASN1_NULL , 22.Nm i2d_ASN1_NULL 23.Nd decode and encode an ASN.1 NULL type 24.Sh SYNOPSIS 25.In openssl/asn1.h 26.Ft ASN1_NULL * 27.Fo d2i_ASN1_NULL 28.Fa "ASN1_NULL **val_out" 29.Fa "const unsigned char **der_in" 30.Fa "long length" 31.Fc 32.Ft int 33.Fo i2d_ASN1_NULL 34.Fa "ASN1_NULL *val_in" 35.Fa "unsigned char **der_out" 36.Fc 37.Sh DESCRIPTION 38These functions decode and encode the ASN.1 value NULL of type NULL. 39For details about the semantics, examples, caveats, and bugs, see 40.Xr ASN1_item_d2i 3 . 41.Pp 42.Fn d2i_ASN1_NULL 43verifies that the BER-encoded value at 44.Pf * Fa der_in 45is NULL and of type NULL. 46It fails if 47.Fa length 48is less than 2 or if the first two bytes of 49.Pf * Fa der_in 50differ from 0x05 and 0x00. 51In case of success, 52.Pf * Fa der_in 53is advanced by two bytes and 54.Pf * Fa val_out 55is set to a specific invalid pointer representing the unique 56.Vt ASN1_NULL 57object. 58.Pp 59.Fn i2d_ASN1_NULL 60ignores 61.Fa val_in 62and encodes the ASN.1 value NULL of type NULL using DER. 63Specifically, it writes the identifier octet for the type NULL, 640x05, followed by the length octet 0x00, and no content or 65end-of-content octets. 66.Sh RETURN VALUES 67.Fn d2i_ASN1_NULL 68returns a specific invalid pointer representing the unique 69.Vt ASN1_NULL 70object or 71.Dv NULL 72if an error occurs. 73.Pp 74.Fn i2d_ASN1_NULL 75returns 2 if successful or 0 if an error occurs. 76.Sh SEE ALSO 77.Xr ASN1_item_d2i 3 , 78.Xr ASN1_item_new 3 , 79.Xr ASN1_NULL_new 3 , 80.Xr ASN1_TYPE_get 3 81.Sh STANDARDS 82ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: 83Information technology - ASN.1 encoding rules: 84Specification of Basic Encoding Rules (BER), Canonical Encoding 85Rules (CER) and Distinguished Encoding Rules (DER), 86section 8.8: Encoding of null value 87.Sh HISTORY 88.Fn d2i_ASN1_NULL 89and 90.Fn i2d_ASN1_NULL 91first appeared in OpenSSL 0.9.5 and have been available since 92.Ox 2.7 . 93