blob: 9b98afe2e372f2eccd6801ec8b30ddbf0f9262e8 [file] [log] [blame]
Paul Bakkerbdb912d2012-02-13 23:11:30 +00001/**
2 * \file asn1write.h
3 *
4 * \brief ASN.1 buffer writing functionality
5 *
Paul Bakker407a0da2013-06-27 14:29:21 +02006 * Copyright (C) 2006-2013, Brainspark B.V.
Paul Bakkerbdb912d2012-02-13 23:11:30 +00007 *
8 * This file is part of PolarSSL (http://www.polarssl.org)
9 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
10 *
11 * All rights reserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 */
27#ifndef POLARSSL_ASN1_WRITE_H
28#define POLARSSL_ASN1_WRITE_H
29
30#include "asn1.h"
31
Paul Bakkerbdb912d2012-02-13 23:11:30 +000032#define ASN1_CHK_ADD(g, f) if( ( ret = f ) < 0 ) return( ret ); else g += ret
33
Paul Bakker407a0da2013-06-27 14:29:21 +020034#ifdef __cplusplus
35extern "C" {
36#endif
37
Paul Bakkerbdb912d2012-02-13 23:11:30 +000038int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
39int asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag );
Paul Bakkered27a042013-04-18 22:46:23 +020040#if defined(POLARSSL_BIGNUM_C)
Paul Bakkerbdb912d2012-02-13 23:11:30 +000041int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
Paul Bakkered27a042013-04-18 22:46:23 +020042#endif
Paul Bakkerbdb912d2012-02-13 23:11:30 +000043int asn1_write_null( unsigned char **p, unsigned char *start );
Paul Bakker37de6be2013-04-07 13:11:31 +020044int asn1_write_oid( unsigned char **p, unsigned char *start, const char *oid );
45int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start, const char *algorithm_oid );
Paul Bakkerbdb912d2012-02-13 23:11:30 +000046int asn1_write_int( unsigned char **p, unsigned char *start, int val );
47int asn1_write_printable_string( unsigned char **p, unsigned char *start,
48 char *text );
Paul Bakker05888152012-02-16 10:26:57 +000049int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
50 char *text );
Paul Bakker598e4502013-08-25 14:46:39 +020051int asn1_write_bitstring( unsigned char **p, unsigned char *start,
52 const unsigned char *buf, size_t bits );
53int asn1_write_octet_string( unsigned char **p, unsigned char *start,
54 const unsigned char *buf, size_t size );
Paul Bakker6db915b2013-08-26 12:05:02 +020055int asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
56 const unsigned char *buf, size_t size );
Paul Bakkerbdb912d2012-02-13 23:11:30 +000057
Paul Bakker407a0da2013-06-27 14:29:21 +020058#ifdef __cplusplus
59}
60#endif
61
Paul Bakkerbdb912d2012-02-13 23:11:30 +000062#endif /* POLARSSL_ASN1_WRITE_H */