quel 64bit warnings, fixup implicit encoding for template, fix spelling
This commit is contained in:
@@ -33,9 +33,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
@@ -48,11 +46,10 @@
|
||||
#include <heim_asn1.h>
|
||||
#include <rfc2459_asn1.h>
|
||||
#include <test_asn1.h>
|
||||
#include <cms_asn1.h>
|
||||
|
||||
#include "check-common.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
static char *lha_principal[] = { "lha" };
|
||||
static char *lharoot_princ[] = { "lha", "root" };
|
||||
static char *datan_princ[] = { "host", "nutcracker.e.kth.se" };
|
||||
@@ -60,7 +57,7 @@ static char *nada_tgt_principal[] = { "krbtgt", "NADA.KTH.SE" };
|
||||
|
||||
|
||||
#define IF_OPT_COMPARE(ac,bc,e) \
|
||||
if (((ac)->e == NULL && (bc)->e != NULL) || (((ac)->e != NULL && (bc)->e == NULL))) return 1; if ((ac)->e)
|
||||
if (((ac)->e == NULL && (bc)->e != NULL) || (((ac)->e != NULL && (bc)->e == NULL))) return 1; if ((ab)->e)
|
||||
#define COMPARE_OPT_STRING(ac,bc,e) \
|
||||
do { if (strcmp(*(ac)->e, *(bc)->e) != 0) return 1; } while(0)
|
||||
#define COMPARE_OPT_OCTECT_STRING(ac,bc,e) \
|
||||
@@ -675,6 +672,91 @@ test_cert(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct {
|
||||
const char *sd;
|
||||
size_t len;
|
||||
} signeddata[] = {
|
||||
{
|
||||
"\x30\x80\x02\x01\x03\x31\x0b\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a"
|
||||
"\x05\x00\x30\x80\x06\x07\x2b\x06\x01\x05\x02\x03\x03\xa0\x80\x24"
|
||||
"\x80\x04\x50\x30\x4e\xa0\x2b\x30\x29\xa0\x03\x02\x01\x12\xa1\x22"
|
||||
"\x04\x20\x78\xf4\x86\x31\xc6\xc2\xc9\xcb\xef\x0c\xd7\x3a\x2a\xcd"
|
||||
"\x8c\x13\x34\x83\xb1\x5c\xa8\xbe\xbf\x2f\xea\xd2\xbb\xd8\x8c\x18"
|
||||
"\x47\x01\xa1\x1f\x30\x1d\xa0\x03\x02\x01\x0c\xa1\x16\x04\x14\xa6"
|
||||
"\x2c\x52\xb2\x80\x98\x30\x40\xbc\x5f\xb0\x77\x2d\x8a\xd7\xa1\xda"
|
||||
"\x3c\xc5\x62\x00\x00\x00\x00\x00\x00\xa0\x82\x02\x09\x30\x82\x02"
|
||||
"\x05\x30\x82\x01\x6e\xa0\x03\x02\x01\x02\x02\x04\x49\x75\x57\xbf"
|
||||
"\x30\x0b\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x05\x30\x3b\x31"
|
||||
"\x1f\x30\x1d\x06\x03\x55\x04\x03\x0c\x16\x63\x6f\x6d\x2e\x61\x70"
|
||||
"\x70\x6c\x65\x2e\x6b\x65\x72\x62\x65\x72\x6f\x73\x2e\x6b\x64\x63"
|
||||
"\x31\x18\x30\x16\x06\x03\x55\x04\x0a\x0c\x0f\x53\x79\x73\x74\x65"
|
||||
"\x6d\x20\x49\x64\x65\x6e\x74\x69\x74\x79\x30\x1e\x17\x0d\x30\x39"
|
||||
"\x31\x32\x30\x34\x30\x30\x32\x30\x32\x34\x5a\x17\x0d\x32\x39\x31"
|
||||
"\x31\x32\x39\x30\x30\x32\x30\x32\x34\x5a\x30\x3b\x31\x1f\x30\x1d"
|
||||
"\x06\x03\x55\x04\x03\x0c\x16\x63\x6f\x6d\x2e\x61\x70\x70\x6c\x65"
|
||||
"\x2e\x6b\x65\x72\x62\x65\x72\x6f\x73\x2e\x6b\x64\x63\x31\x18\x30"
|
||||
"\x16\x06\x03\x55\x04\x0a\x0c\x0f\x53\x79\x73\x74\x65\x6d\x20\x49"
|
||||
"\x64\x65\x6e\x74\x69\x74\x79\x30\x81\x9f\x30\x0d\x06\x09\x2a\x86"
|
||||
"\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x81\x8d\x00\x30\x81\x89"
|
||||
"\x02\x81\x81\x00\xb2\xc5\x4b\x34\xe3\x93\x99\xbb\xaa\xd1\x70\x62"
|
||||
"\x6c\x9c\xcc\xa6\xbc\x47\xc3\x23\xff\x15\xb9\x11\x27\x0a\xf8\x55"
|
||||
"\x4c\xb2\x43\x34\x75\xad\x55\xbb\xb9\x8a\xd0\x25\x64\xa4\x8c\x82"
|
||||
"\x74\x5d\x89\x52\xe2\x76\x75\x08\x67\xb5\x9c\x9c\x69\x86\x0c\x6d"
|
||||
"\x79\xf7\xa0\xbe\x42\x8f\x90\x46\x0c\x18\xf4\x7a\x56\x17\xa4\x65"
|
||||
"\x00\x3a\x5e\x3e\xbf\xbc\xf5\xe2\x2c\x26\x03\x52\xdd\xd4\x85\x3f"
|
||||
"\x03\xd7\x0c\x45\x7f\xff\xdd\x1e\x70\x6c\x9f\xb0\x8c\xd0\x33\xad"
|
||||
"\x92\x54\x17\x9d\x88\x89\x1a\xee\xef\xf7\x96\x3e\x68\xc3\xd1\x60"
|
||||
"\x47\x86\x80\x5d\x02\x03\x01\x00\x01\xa3\x18\x30\x16\x30\x14\x06"
|
||||
"\x03\x55\x1d\x25\x04\x0d\x30\x0b\x06\x09\x2a\x86\x48\x86\xf7\x63"
|
||||
"\x64\x04\x04\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x05"
|
||||
"\x05\x00\x03\x81\x81\x00\x9b\xbb\xaa\x63\x66\xd8\x70\x84\x3e\xf6"
|
||||
"\xa1\x3b\xf3\xe6\xd7\x3d\xfc\x4f\xc9\x45\xaa\x31\x43\x8d\xb5\x72"
|
||||
"\xe4\x34\x95\x7b\x6e\x5f\xe5\xc8\x5e\xaf\x12\x08\x6d\xd7\x25\x76"
|
||||
"\x40\xd5\xdc\x83\x7f\x2f\x74\xd1\x63\xc0\x7c\x26\x4d\x53\x10\xe7"
|
||||
"\xfa\xcc\xf2\x60\x41\x63\xdf\x56\xd6\xd9\xc0\xb4\xd0\x73\x99\x54"
|
||||
"\x40\xad\x90\x79\x2d\xd2\x5e\xcb\x13\x22\x2b\xd0\x76\xef\x8a\x48"
|
||||
"\xfd\xb2\x6e\xca\x04\x4e\x91\x3f\xb4\x63\xad\x22\x3a\xf7\x20\x9c"
|
||||
"\x4c\x0e\x47\x78\xe5\x2a\x85\x0e\x90\x7a\xce\x46\xe6\x15\x02\xb0"
|
||||
"\x83\xe7\xac\xfa\x92\xf8\x31\x81\xe8\x30\x81\xe5\x02\x01\x01\x30"
|
||||
"\x43\x30\x3b\x31\x1f\x30\x1d\x06\x03\x55\x04\x03\x0c\x16\x63\x6f"
|
||||
"\x6d\x2e\x61\x70\x70\x6c\x65\x2e\x6b\x65\x72\x62\x65\x72\x6f\x73"
|
||||
"\x2e\x6b\x64\x63\x31\x18\x30\x16\x06\x03\x55\x04\x0a\x0c\x0f\x53"
|
||||
"\x79\x73\x74\x65\x6d\x20\x49\x64\x65\x6e\x74\x69\x74\x79\x02\x04"
|
||||
"\x49\x75\x57\xbf\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x30"
|
||||
"\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x04\x81"
|
||||
"\x80\x50\x2c\x69\xe1\xd2\xc4\xd1\xcc\xdc\xe0\xe9\x8a\x6b\x6a\x97"
|
||||
"\x1b\xb4\xe0\xa8\x20\xbe\x09\x6d\xe1\x55\x5f\x07\x70\x94\x2e\x14"
|
||||
"\xed\x4e\xb1\x69\x75\x40\xbb\x99\x87\xed\x23\x50\x27\x5f\xaa\xc4"
|
||||
"\x84\x60\x06\xfe\x45\xfd\x7e\x1b\x18\xe0\x0b\x77\x35\x2a\xb2\xf2"
|
||||
"\xe0\x88\x31\xad\x82\x31\x4a\xbc\x6d\x71\x62\xe6\x4d\x33\xb4\x09"
|
||||
"\x6e\x3f\x14\x12\xf2\x89\x29\x31\x84\x60\x2b\xa8\x2d\xe6\xca\x2f"
|
||||
"\x03\x3d\xd4\x69\x89\xb3\x98\xfd\xac\x63\x14\xaf\x6a\x52\x2a\xac"
|
||||
"\xe3\x8e\xfa\x21\x41\x8f\xcc\x04\x2d\x52\xee\x49\x54\x0d\x58\x51"
|
||||
"\x77\x00\x00",
|
||||
883
|
||||
}
|
||||
};
|
||||
|
||||
static int
|
||||
test_SignedData(void)
|
||||
{
|
||||
SignedData sd;
|
||||
size_t size, i;
|
||||
int ret;
|
||||
|
||||
for (i = 0; i < sizeof(signeddata) / sizeof(signeddata[0]); i++) {
|
||||
|
||||
ret = decode_SignedData((unsigned char *)signeddata[i].sd,
|
||||
signeddata[i].len, &sd, &size);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
free_SignedData(&sd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
cmp_TESTLargeTag (void *a, void *b)
|
||||
@@ -951,6 +1033,7 @@ test_choice (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef IMPLICIT_TAGGING_WORKS
|
||||
static int
|
||||
cmp_TESTImplicit (void *a, void *b)
|
||||
{
|
||||
@@ -962,27 +1045,30 @@ cmp_TESTImplicit (void *a, void *b)
|
||||
COMPARE_INTEGER(aa,ab,ti3);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
UNIV CONS Sequence 14
|
||||
CONTEXT PRIM 0 1 00
|
||||
CONTEXT CONS 1 6
|
||||
CONTEXT CONS 127 3
|
||||
UNIV PRIM Integer 1 02
|
||||
CONTEXT CONS 127 3
|
||||
UNIV PRIM Integer 1 02
|
||||
CONTEXT PRIM 2 1 03
|
||||
*/
|
||||
|
||||
static int
|
||||
test_implicit (void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef IMPLICIT_TAGGING_WORKS
|
||||
struct test_case tests[] = {
|
||||
{ NULL, 16,
|
||||
"\x30\x0e\x80\x01\x00\xa1\x06\xbf"
|
||||
"\x7f\x03\x02\x01\x02\x82\x01\x03",
|
||||
{ NULL, 18,
|
||||
"\x30\x10\x80\x01\x00\xa1\x06\xbf"
|
||||
"\x7f\x03\x02\x01\x02\xa2\x03\x84\x01\x03",
|
||||
"implicit 1" }
|
||||
};
|
||||
|
||||
int ret = 0, ntests = sizeof(tests) / sizeof(*tests);
|
||||
int ntests = sizeof(tests) / sizeof(*tests);
|
||||
TESTImplicit c0;
|
||||
|
||||
memset(&c0, 0, sizeof(c0));
|
||||
@@ -999,7 +1085,6 @@ test_implicit (void)
|
||||
cmp_TESTImplicit,
|
||||
(generic_copy)copy_TESTImplicit);
|
||||
|
||||
#ifdef IMPLICIT_TAGGING_WORKS
|
||||
ret += generic_test (tests, ntests, sizeof(TESTImplicit2),
|
||||
(generic_encode)encode_TESTImplicit2,
|
||||
(generic_length)length_TESTImplicit2,
|
||||
@@ -1261,6 +1346,30 @@ check_fail_choice(void)
|
||||
(generic_decode)decode_TESTChoice1);
|
||||
}
|
||||
|
||||
static int
|
||||
check_fail_Ticket(void)
|
||||
{
|
||||
char buf[100];
|
||||
size_t i;
|
||||
int ret;
|
||||
struct test_case test;
|
||||
Ticket ticket;
|
||||
|
||||
for (i = 0; i < sizeof(buf); i++) {
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memset(&ticket, 0, sizeof(ticket));
|
||||
test.val = &ticket;
|
||||
test.byte_len = i;
|
||||
test.bytes = buf;
|
||||
test.name = "zero life";
|
||||
ret = generic_decode_fail(&test, 1, sizeof(Ticket),
|
||||
(generic_decode)decode_Ticket);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
check_seq(void)
|
||||
{
|
||||
@@ -1409,6 +1518,7 @@ check_TESTMechTypeList(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef IMPLICIT_TAGGING_WORKS
|
||||
static int
|
||||
cmp_TESTSeqOf4(void *a, void *b)
|
||||
{
|
||||
@@ -1451,10 +1561,13 @@ cmp_TESTSeqOf4(void *a, void *b)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* IMPLICIT_TAGGING_WORKS */
|
||||
|
||||
static int
|
||||
test_seq4 (void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef IMPLICIT_TAGGING_WORKS
|
||||
struct test_case tests[] = {
|
||||
{ NULL, 2,
|
||||
"\x30\x00",
|
||||
@@ -1499,7 +1612,7 @@ test_seq4 (void)
|
||||
"seq4 3" },
|
||||
};
|
||||
|
||||
int ret = 0, ntests = sizeof(tests) / sizeof(*tests);
|
||||
int ntests = sizeof(tests) / sizeof(*tests);
|
||||
TESTSeqOf4 c[4];
|
||||
struct TESTSeqOf4_b1 b1[4];
|
||||
struct TESTSeqOf4_b2 b2[4];
|
||||
@@ -1577,7 +1690,7 @@ test_seq4 (void)
|
||||
(generic_free)free_TESTSeqOf4,
|
||||
cmp_TESTSeqOf4,
|
||||
(generic_copy)copy_TESTSeqOf4);
|
||||
|
||||
#endif /* IMPLICIT_TAGGING_WORKS */
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1602,15 +1715,18 @@ main(int argc, char **argv)
|
||||
ret += test_choice();
|
||||
|
||||
ret += test_implicit();
|
||||
|
||||
ret += test_taglessalloc();
|
||||
ret += test_optional();
|
||||
|
||||
ret += check_fail_largetag();
|
||||
ret += check_fail_sequence();
|
||||
ret += check_fail_choice();
|
||||
ret += check_fail_Ticket();
|
||||
|
||||
ret += check_seq();
|
||||
ret += check_seq_of_size();
|
||||
ret += test_SignedData();
|
||||
|
||||
ret += check_TESTMechTypeList();
|
||||
ret += test_seq4();
|
||||
|
Reference in New Issue
Block a user