Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2006 Pekka Riikonen
+ Copyright (C) 2003 - 2007 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
*
* DESCRIPTION
*
- * Macro used to encode or decode boolean value. Type boolean type
+ * Macro used to encode or decode boolean value. The boolean type
* is SilcBool.
*
* The `opts' is SilcAsn1Options. The `tag' is a tag number.
* DESCRIPTION
*
* Macro used to encode or decode octet string. The string type is
- * unsigned char and string length SilcUInt32.
+ * unsigned char and string length SilcUInt32. Octet string is
+ * considered to be 8-bit unsigned binary data.
*
* The `opts' is SilcAsn1Options. The `tag' is a tag number.
*
- * NOTES
- *
- * The string must be in UTF-8 encoding when encoding. The decoded
- * string will be in UTF-8 encoding. The actual data is encoded to
- * or decoded from 8-bit ASCII.
- *
***/
#define SILC_ASN1_OCTET_STRING(x, xl) SILC_ASN1_U2(OCTET_STRING, x, xl)
#define SILC_ASN1_OCTET_STRING_T(o, t, x, xl) SILC_ASN1_T2(OCTET_STRING, o, t, x, xl)
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2006 Pekka Riikonen
+ Copyright (C) 2003 - 2007 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
case SILC_ASN1_TAG_OCTET_STRING:
{
- /* Octet string. We take it as 8-bit ASCII */
+ /* Octet string. Take data as is. */
SILC_ASN1_VAD_UCHAR(asn1, opts, unsigned char, s, s_len);
- SILC_ASN1_DECODE_STRING(SILC_STRING_ASCII, s, s_len);
+ *s = silc_smemdup(stack1, rdata, rdata_len);
+ *s_len = rdata_len;
break;
}
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 2006 Pekka Riikonen
+ Copyright (C) 2003 - 2007 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
case SILC_ASN1_TAG_OCTET_STRING:
{
- /* Octet string. We put it in as 8-bit ASCII */
- SILC_ASN1_ENCODE_STRING(SILC_STRING_ASCII);
+ /* Octet string. Put data as is. */
+ unsigned char *d = va_arg(asn1->ap, unsigned char *);
+ SilcUInt32 d_len = va_arg(asn1->ap, SilcUInt32);
+
+ len = silc_ber_encoded_len(tag, d_len, indef);
+ dest = silc_buffer_srealloc_size(stack1, dest,
+ silc_buffer_truelen(dest) + len);
+ ret = silc_ber_encode(dest, ber_class, SILC_BER_ENC_PRIMITIVE,
+ tag, d, d_len, indef);
+ if (!ret)
+ goto fail;
break;
}
SILC_LOG_DEBUG(("Decoding success"));
printf("\n");
-
-#endif
+#endif /* 1 */
silc_asn1_free(asn1);
+ success = TRUE;
out:
- exit(success);
+ SILC_LOG_DEBUG(("Testing was %s", success ? "SUCCESS" : "FAILURE"));
+ fprintf(stderr, "Testing was %s\n", success ? "SUCCESS" : "FAILURE");
+
+ return success;
}