blob: f7efb20cdb4d5935998d1e6c7bda46358f1c86d1 [file] [log] [blame]
Paul Bakkerbdb912d2012-02-13 23:11:30 +00001/**
2 * \file asn1write.h
3 *
4 * \brief ASN.1 buffer writing functionality
5 *
6 * Copyright (C) 2006-2012, Brainspark B.V.
7 *
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
34int asn1_write_len( unsigned char **p, unsigned char *start, size_t len );
35int asn1_write_tag( unsigned char **p, unsigned char *start, unsigned char tag );
Paul Bakkered27a042013-04-18 22:46:23 +020036#if defined(POLARSSL_BIGNUM_C)
Paul Bakkerbdb912d2012-02-13 23:11:30 +000037int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X );
Paul Bakkered27a042013-04-18 22:46:23 +020038#endif
Paul Bakkerbdb912d2012-02-13 23:11:30 +000039int asn1_write_null( unsigned char **p, unsigned char *start );
Paul Bakker37de6be2013-04-07 13:11:31 +020040int asn1_write_oid( unsigned char **p, unsigned char *start, const char *oid );
41int asn1_write_algorithm_identifier( unsigned char **p, unsigned char *start, const char *algorithm_oid );
Paul Bakkerbdb912d2012-02-13 23:11:30 +000042int asn1_write_int( unsigned char **p, unsigned char *start, int val );
43int asn1_write_printable_string( unsigned char **p, unsigned char *start,
44 char *text );
Paul Bakker05888152012-02-16 10:26:57 +000045int asn1_write_ia5_string( unsigned char **p, unsigned char *start,
46 char *text );
Paul Bakkerbdb912d2012-02-13 23:11:30 +000047
48#endif /* POLARSSL_ASN1_WRITE_H */