ReactOS 0.4.16-dev-297-gc569aee
asn1write.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 *
10 * This file is provided under the Apache License 2.0, or the
11 * GNU General Public License v2.0 or later.
12 *
13 * **********
14 * Apache License 2.0:
15 *
16 * Licensed under the Apache License, Version 2.0 (the "License"); you may
17 * not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 * http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 *
28 * **********
29 *
30 * **********
31 * GNU General Public License v2.0 or later:
32 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU General Public License as published by
35 * the Free Software Foundation; either version 2 of the License, or
36 * (at your option) any later version.
37 *
38 * This program is distributed in the hope that it will be useful,
39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 * GNU General Public License for more details.
42 *
43 * You should have received a copy of the GNU General Public License along
44 * with this program; if not, write to the Free Software Foundation, Inc.,
45 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
46 *
47 * **********
48 */
49#ifndef MBEDTLS_ASN1_WRITE_H
50#define MBEDTLS_ASN1_WRITE_H
51
52#if !defined(MBEDTLS_CONFIG_FILE)
53#include "config.h"
54#else
55#include MBEDTLS_CONFIG_FILE
56#endif
57
58#include "asn1.h"
59
60#define MBEDTLS_ASN1_CHK_ADD(g, f) \
61 do \
62 { \
63 if( ( ret = (f) ) < 0 ) \
64 return( ret ); \
65 else \
66 (g) += ret; \
67 } while( 0 )
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
85int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start,
86 size_t len );
99int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start,
100 unsigned char tag );
101
115int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
116 const unsigned char *buf, size_t size );
117
118#if defined(MBEDTLS_BIGNUM_C)
132int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start,
133 const mbedtls_mpi *X );
134#endif /* MBEDTLS_BIGNUM_C */
135
148int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start );
149
164int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
165 const char *oid, size_t oid_len );
166
183 unsigned char *start,
184 const char *oid, size_t oid_len,
185 size_t par_len );
186
200int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start,
201 int boolean );
202
216int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val );
217
235int mbedtls_asn1_write_tagged_string( unsigned char **p, unsigned char *start,
236 int tag, const char *text,
237 size_t text_len );
238
255 unsigned char *start,
256 const char *text, size_t text_len );
257
273int mbedtls_asn1_write_utf8_string( unsigned char **p, unsigned char *start,
274 const char *text, size_t text_len );
275
291int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
292 const char *text, size_t text_len );
293
308int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
309 const unsigned char *buf, size_t bits );
310
325int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start,
326 const unsigned char *buf, size_t size );
327
346 const char *oid, size_t oid_len,
347 const unsigned char *val,
348 size_t val_len );
349
350#ifdef __cplusplus
351}
352#endif
353
354#endif /* MBEDTLS_ASN1_WRITE_H */
Generic ASN.1 parsing.
int mbedtls_asn1_write_raw_buffer(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write raw buffer data.
int mbedtls_asn1_write_tag(unsigned char **p, unsigned char *start, unsigned char tag)
Write an ASN.1 tag in ASN.1 format.
int mbedtls_asn1_write_bitstring(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t bits)
Write a bitstring tag (MBEDTLS_ASN1_BIT_STRING) and value in ASN.1 format.
int mbedtls_asn1_write_printable_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write a string in ASN.1 format using the PrintableString string encoding tag (MBEDTLS_ASN1_PRINTABLE_...
int mbedtls_asn1_write_utf8_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write a UTF8 string in ASN.1 format using the UTF8String string encoding tag (MBEDTLS_ASN1_PRINTABLE_...
int mbedtls_asn1_write_octet_string(unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size)
Write an octet string tag (MBEDTLS_ASN1_OCTET_STRING) and value in ASN.1 format.
mbedtls_asn1_named_data * mbedtls_asn1_store_named_data(mbedtls_asn1_named_data **list, const char *oid, size_t oid_len, const unsigned char *val, size_t val_len)
Create or find a specific named_data entry for writing in a sequence or list based on the OID....
int mbedtls_asn1_write_int(unsigned char **p, unsigned char *start, int val)
Write an int tag (MBEDTLS_ASN1_INTEGER) and value in ASN.1 format.
int mbedtls_asn1_write_len(unsigned char **p, unsigned char *start, size_t len)
Write a length field in ASN.1 format.
int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len, size_t par_len)
Write an AlgorithmIdentifier sequence in ASN.1 format.
int mbedtls_asn1_write_oid(unsigned char **p, unsigned char *start, const char *oid, size_t oid_len)
Write an OID tag (MBEDTLS_ASN1_OID) and data in ASN.1 format.
int mbedtls_asn1_write_mpi(unsigned char **p, unsigned char *start, const mbedtls_mpi *X)
Write a arbitrary-precision number (MBEDTLS_ASN1_INTEGER) in ASN.1 format.
int mbedtls_asn1_write_tagged_string(unsigned char **p, unsigned char *start, int tag, const char *text, size_t text_len)
Write a string in ASN.1 format using a specific string encoding tag.
int mbedtls_asn1_write_null(unsigned char **p, unsigned char *start)
Write a NULL tag (MBEDTLS_ASN1_NULL) with zero data in ASN.1 format.
int mbedtls_asn1_write_bool(unsigned char **p, unsigned char *start, int boolean)
Write a boolean tag (MBEDTLS_ASN1_BOOLEAN) and value in ASN.1 format.
int mbedtls_asn1_write_ia5_string(unsigned char **p, unsigned char *start, const char *text, size_t text_len)
Write a string in ASN.1 format using the IA5String string encoding tag (MBEDTLS_ASN1_IA5_STRING).
Definition: list.h:37
const WCHAR * text
Definition: package.c:1794
GLuint start
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
GLuint GLfloat * val
Definition: glext.h:7180
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
MPI structure.
Definition: bignum.h:211
Definition: ecma_167.h:138