[Redbutton-devel] SF.net SVN: redbutton: [411] redbutton-author/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-09-22 16:55:39
|
Revision: 411
http://redbutton.svn.sourceforge.net/redbutton/?rev=411&view=rev
Author: skilvington
Date: 2007-09-22 09:55:38 -0700 (Sat, 22 Sep 2007)
Log Message:
-----------
the skeleton needed to start generating complete DER objects
Modified Paths:
--------------
redbutton-author/trunk/der_encode.c
redbutton-author/trunk/der_encode.h
redbutton-author/trunk/mhegc.c
redbutton-author/trunk/parser.c.header
redbutton-author/trunk/parser.h.header
Modified: redbutton-author/trunk/der_encode.c
===================================================================
--- redbutton-author/trunk/der_encode.c 2007-09-22 16:49:21 UTC (rev 410)
+++ redbutton-author/trunk/der_encode.c 2007-09-22 16:55:38 UTC (rev 411)
@@ -210,5 +210,20 @@
void
convert_BASE64(unsigned char **out, unsigned int *len, const unsigned char *str)
{
+/* TODO */
+printf("TODO: convert_BASE64\n");
}
+/*
+ * recursively generate the DER tag/length header for the tree of nodes
+ */
+
+unsigned int
+gen_der_header(struct node *n)
+{
+/* TODO */
+printf("TODO: gen_der_header\n");
+
+ return n->hdr_length + n->length;
+}
+
Modified: redbutton-author/trunk/der_encode.h
===================================================================
--- redbutton-author/trunk/der_encode.h 2007-09-22 16:49:21 UTC (rev 410)
+++ redbutton-author/trunk/der_encode.h 2007-09-22 16:55:38 UTC (rev 411)
@@ -5,6 +5,8 @@
#ifndef __DER_ENCODE_H__
#define __DER_ENCODE_H__
+#include "parser.h"
+
#include <stdbool.h>
void der_encode_BOOLEAN(unsigned char **, unsigned int *, bool);
@@ -15,5 +17,7 @@
void convert_QPRINTABLE(unsigned char **, unsigned int *, const unsigned char *);
void convert_BASE64(unsigned char **, unsigned int *, const unsigned char *);
+unsigned int gen_der_header(struct node *);
+
#endif /* __DER_ENCODE_H__ */
Modified: redbutton-author/trunk/mhegc.c
===================================================================
--- redbutton-author/trunk/mhegc.c 2007-09-22 16:49:21 UTC (rev 410)
+++ redbutton-author/trunk/mhegc.c 2007-09-22 16:55:38 UTC (rev 411)
@@ -27,6 +27,7 @@
#include <strings.h>
#include "parser.h"
+#include "der_encode.h"
#include "asn1tag.h"
#include "utils.h"
@@ -44,6 +45,7 @@
int arg;
struct node asn1obj;
unsigned int nerrs;
+ unsigned int filesize;
while((arg = getopt(argc, argv, "v")) != EOF)
{
@@ -94,6 +96,10 @@
print_node(&asn1obj, 0);
}
+ /* create the DER tag/length header for each node */
+ filesize = gen_der_header(&asn1obj);
+ verbose("\nDER Object size: %u bytes\n", filesize);
+
return EXIT_SUCCESS;
}
Modified: redbutton-author/trunk/parser.c.header
===================================================================
--- redbutton-author/trunk/parser.c.header 2007-09-22 16:49:21 UTC (rev 410)
+++ redbutton-author/trunk/parser.c.header 2007-09-22 16:55:38 UTC (rev 411)
@@ -46,8 +46,13 @@
/* class is in the top 8 bits, tag is the bottom 24 bits */
child->asn1tag = asn1tagclass & 0xffffff;
child->asn1class = (asn1tagclass >> 24) & 0xff;
+ /* DER tag/length header */
+ child->hdr_length = 0;
+ child->hdr_value = NULL;
+ /* DER value */
child->length = 0;
child->value = NULL;
+ /* the tree of nodes */
child->parent = parent;
child->children = NULL;
child->siblings = NULL;
Modified: redbutton-author/trunk/parser.h.header
===================================================================
--- redbutton-author/trunk/parser.h.header 2007-09-22 16:49:21 UTC (rev 410)
+++ redbutton-author/trunk/parser.h.header 2007-09-22 16:55:38 UTC (rev 411)
@@ -13,6 +13,9 @@
/* DER type */
unsigned int asn1tag; /* ASN1 tag number */
unsigned int asn1class; /* only UNIVERSAL or CONTEXT */
+ /* DER tag/length header */
+ unsigned int hdr_length;
+ unsigned char *hdr_value;
/* DER value */
unsigned int length; /* length of the value data */
unsigned char *value; /* DER encoded value */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|