Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2005 Pekka Riikonen
+ Copyright (C) 2003 - 2008 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
*/
/* Basic Encoding Rules (BER) encoder and decoder. */
-#include "silcincludes.h"
+#include "silccrypto.h"
#include "silcber.h"
/* Encodes a BER data block into the `ber', which must already have
include the length of the data in the BER block. */
SilcBool silc_ber_encode(SilcBuffer ber, SilcBerClass ber_class,
- SilcBerEncoding encoding, SilcUInt32 tag,
- const unsigned char *data, SilcUInt32 data_len,
- SilcBool indefinite)
+ SilcBerEncoding encoding, SilcUInt32 tag,
+ const unsigned char *data, SilcUInt32 data_len,
+ SilcBool indefinite)
{
int i = 0, c;
SilcUInt32 tmp;
/* Long form */
/* Calculate the number of octets for the length field */
- tmp = tag;
+ tmp = data_len;
c = 0;
while (tmp) {
c++;
of the entire BER object is `identifier_len' + `data_len'. */
SilcBool silc_ber_decode(SilcBuffer ber, SilcBerClass *ber_class,
- SilcBerEncoding *encoding, SilcUInt32 *tag,
- const unsigned char **data, SilcUInt32 *data_len,
- SilcBool *indefinite, SilcUInt32 *identifier_len)
+ SilcBerEncoding *encoding, SilcUInt32 *tag,
+ const unsigned char **data, SilcUInt32 *data_len,
+ SilcBool *indefinite, SilcUInt32 *identifier_len)
{
int i = 0, c;
SilcUInt32 t;