libtasn1-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU libtasn1 branch, master, updated. libtasn1_4_2-11-gb7e5386


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU libtasn1 branch, master, updated. libtasn1_4_2-11-gb7e5386
Date: Wed, 04 Mar 2015 16:50:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU libtasn1".

http://git.savannah.gnu.org/cgit/libtasn1.git/commit/?id=b7e5386d669d72fcec154d571d28e128ffc5db1b

The branch, master has been updated
       via  b7e5386d669d72fcec154d571d28e128ffc5db1b (commit)
      from  c27c19c3c419280870e3de498d3b44f602368a3c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b7e5386d669d72fcec154d571d28e128ffc5db1b
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Wed Mar 4 17:49:43 2015 +0100

    Added missing file

-----------------------------------------------------------------------

Summary of changes:
 tests/Test_choice_ocsp.c |   80 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)
 create mode 100644 tests/Test_choice_ocsp.c

diff --git a/tests/Test_choice_ocsp.c b/tests/Test_choice_ocsp.c
new file mode 100644
index 0000000..253a2e2
--- /dev/null
+++ b/tests/Test_choice_ocsp.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <libtasn1.h>
+
+int
+main (int argc, char** argv)
+{
+  int result = 0, len;
+  asn1_node definitions = NULL, node1 = NULL;
+  char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE];
+  const char *choicefile = getenv ("ASN1CHOICE_OCSP");
+  const char *datafile = getenv ("ASN1CHOICE_OCSP_DATA");
+  FILE *fp;
+  char data[1024];
+  char data2[1024];
+  int data_size = sizeof (data);
+
+  if (!choicefile)
+    choicefile = "pkix.asn";
+
+  if (!datafile)
+    datafile = "ocsp.der";
+
+  /* Encode */
+  result = asn1_parser2tree (choicefile, &definitions, errorDescription);
+  if (result != ASN1_SUCCESS)
+    {
+      printf ("error in %d: %s\n", __LINE__, errorDescription);
+      exit (1);
+    }
+
+  result = asn1_create_element (definitions, "PKIX1.ResponseData", &node1);
+  if (result != ASN1_SUCCESS)
+    {
+      printf ("error in %d\n", __LINE__);
+      exit (1);
+    }
+
+  fp = fopen(datafile, "r");
+  if (fp == NULL)
+    {
+      printf ("error in %d\n", __LINE__);
+      exit (1);
+    }
+  data_size = fread(data, 1, sizeof(data), fp);
+  fclose(fp);
+
+  result = asn1_der_decoding (&node1, data, data_size, errorDescription);
+  if (result != ASN1_SUCCESS)
+    {
+      printf ("error in %d: %s\n", __LINE__, errorDescription);
+      exit (1);
+    }
+
+  len = sizeof(data2);
+  result = asn1_der_coding (node1, "", data2, &len, errorDescription);
+  if (result != ASN1_SUCCESS)
+    {
+      printf ("error in %d: %s\n", __LINE__, errorDescription);
+      exit (1);
+    }
+
+  if (len != data_size)
+    {
+      printf ("length doesn't match: known issue\n");
+      exit (77);
+    }
+
+  if (memcmp(data, data2, len) != 0)
+    {
+      printf ("contents don't match: known issue\n");
+      exit (77);
+    }
+
+  asn1_delete_structure (&node1);
+  asn1_delete_structure (&definitions);
+
+  return 0;
+}


hooks/post-receive
-- 
GNU libtasn1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]