Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
asn1_decoder.c File Reference
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/asn1_decoder.h>
#include <linux/asn1_ber_bytecode.h>

Go to the source code of this file.

Macros

#define FLAG_INDEFINITE_LENGTH   0x01
 
#define FLAG_MATCHED   0x02
 
#define FLAG_CONS
 
#define NR_CONS_STACK   10
 
#define NR_JUMP_STACK   10
 

Functions

int asn1_ber_decoder (const struct asn1_decoder *decoder, void *context, const unsigned char *data, size_t datalen)
 
 EXPORT_SYMBOL_GPL (asn1_ber_decoder)
 

Macro Definition Documentation

#define FLAG_CONS
Value:
0x20 /* Corresponds to CONS bit in the opcode tag
* - ie. whether or not we are going to parse
* a compound type.
*/
#define FLAG_INDEFINITE_LENGTH   0x01
#define FLAG_MATCHED   0x02
#define NR_CONS_STACK   10
#define NR_JUMP_STACK   10

Function Documentation

int asn1_ber_decoder ( const struct asn1_decoder decoder,
void context,
const unsigned char data,
size_t  datalen 
)

asn1_ber_decoder - Decoder BER/DER/CER ASN.1 according to pattern : The decoder definition (produced by asn1_compiler) : The caller's context (to be passed to the action functions) : The encoded data : The size of the encoded data

Decode BER/DER/CER encoded ASN.1 data according to a bytecode pattern produced by asn1_compiler. Action functions are called on marked tags to allow the caller to retrieve significant data.

LIMITATIONS:

To keep down the amount of stack used by this function, the following limits have been imposed:

(1) This won't handle datalen > 65535 without increasing the size of the cons stack elements and length_too_long checking.

(2) The stack of constructed types is 10 deep. If the depth of non-leaf constructed types exceeds this, the decode will fail.

(3) The SET type (not the SET OF type) isn't really supported as tracking what members of the set have been seen is a pain.

Definition at line 163 of file asn1_decoder.c.

EXPORT_SYMBOL_GPL ( asn1_ber_decoder  )