projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged silc_1_1_branch to trunk.
[silc.git]
/
lib
/
silcasn1
/
silcasn1_decode.c
diff --git
a/lib/silcasn1/silcasn1_decode.c
b/lib/silcasn1/silcasn1_decode.c
index 911515b2b88ae472c2ba7d5ac2d26cc4ad1e0d05..3030d07cd4af28b3a2093f05ae2b1e58100e24f0 100644
(file)
--- a/
lib/silcasn1/silcasn1_decode.c
+++ b/
lib/silcasn1/silcasn1_decode.c
@@
-4,7
+4,7
@@
Author: Pekka Riikonen <priikone@silcnet.org>
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 200
6
Pekka Riikonen
+ Copyright (C) 2003 - 200
7
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
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
@@
-34,8
+34,7
@@
static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
SilcList types;
SilcAsn1Tag type;
SilcBuffer *retb;
SilcList types;
SilcAsn1Tag type;
SilcBuffer *retb;
- SilcUInt32 *retc;
- SilcAsn1Tag rtag;
+ SilcUInt32 *retc, rtag;
const unsigned char *rdata;
SilcUInt32 rdata_len, len = 0;
SilcBool found = FALSE, rindef;
const unsigned char *rdata;
SilcUInt32 rdata_len, len = 0;
SilcBool found = FALSE, rindef;
@@
-94,7
+93,7
@@
static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
assert(type == SILC_ASN1_END);
/* Decode the SEQUENCE or SET */
assert(type == SILC_ASN1_END);
/* Decode the SEQUENCE or SET */
- ret = silc_ber_decode(src, NULL, NULL,
(SilcUInt32 *)
&rtag, &rdata,
+ ret = silc_ber_decode(src, NULL, NULL, &rtag, &rdata,
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
@@
-108,7
+107,7
@@
static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
while (silc_buffer_len(src)) {
/* Decode the BER data. */
while (silc_buffer_len(src)) {
/* Decode the BER data. */
- ret = silc_ber_decode(src, NULL, NULL,
(SilcUInt32 *)
&rtag, &rdata,
+ ret = silc_ber_decode(src, NULL, NULL, &rtag, &rdata,
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
@@
-231,7
+230,7
@@
static SilcBool silc_asn1_decoder_sof(SilcAsn1 asn1, SilcBuffer src)
ret = FALSE; \
goto fail; \
} \
ret = FALSE; \
goto fail; \
} \
- *s = silc_smalloc
_ua(stack1, *s_len + 1);
\
+ *s = silc_smalloc
(stack1, *s_len + 1);
\
if (*s) { \
silc_utf8_encode(rdata, rdata_len, (enc), *s, *s_len); \
(*s)[*s_len] = '\0'; \
if (*s) { \
silc_utf8_encode(rdata, rdata_len, (enc), *s, *s_len); \
(*s)[*s_len] = '\0'; \
@@
-249,11
+248,11
@@
silc_asn1_decoder(SilcAsn1 asn1, SilcStack stack1, SilcAsn1Tag type,
SilcBool primitive)
{
unsigned char *ptr = src->data;
SilcBool primitive)
{
unsigned char *ptr = src->data;
- SilcAsn1Tag rtype
, rtag
;
+ SilcAsn1Tag rtype;
SilcAsn1Options ropts;
SilcBerClass rclass;
SilcBerEncoding renc;
SilcAsn1Options ropts;
SilcBerClass rclass;
SilcBerEncoding renc;
- SilcUInt32 len = 0;
+ SilcUInt32 len = 0
, rtag
;
SilcBool ret, indef, rindef, found = FALSE, choice = FALSE;
const unsigned char *rdata;
SilcUInt32 rdata_len;
SilcBool ret, indef, rindef, found = FALSE, choice = FALSE;
const unsigned char *rdata;
SilcUInt32 rdata_len;
@@
-317,7
+316,7
@@
silc_asn1_decoder(SilcAsn1 asn1, SilcStack stack1, SilcAsn1Tag type,
/* Now decode a BER encoded block from the source buffer. It must be
exactly the same user is expecting. */
/* Now decode a BER encoded block from the source buffer. It must be
exactly the same user is expecting. */
- ret = silc_ber_decode(src, &rclass, &renc,
(SilcUInt32 *)
&rtag, &rdata,
+ ret = silc_ber_decode(src, &rclass, &renc, &rtag, &rdata,
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
&rdata_len, &rindef, &len);
if (!ret) {
SILC_LOG_DEBUG(("Error parsing BER block, malformed ASN.1 data"));
@@
-665,9
+664,10
@@
silc_asn1_decoder(SilcAsn1 asn1, SilcStack stack1, SilcAsn1Tag type,
case SILC_ASN1_TAG_OCTET_STRING:
{
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_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;
}
break;
}