1 /*
2  * Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
3  * From ASN.1 module "SignedObjectSyntax"
4  * 	found in "rfc6488.asn1"
5  * 	`asn1c -Werror -fcompound-names -fwide-types -D asn1/asn1c -no-gen-PER -no-gen-example`
6  */
7 
8 #include "BinarySigningTime.h"
9 
10 int
BinarySigningTime_constraint(const asn_TYPE_descriptor_t * td,const void * sptr,asn_app_constraint_failed_f * ctfailcb,void * app_key)11 BinarySigningTime_constraint(const asn_TYPE_descriptor_t *td, const void *sptr,
12 			asn_app_constraint_failed_f *ctfailcb, void *app_key) {
13 	const BinaryTime_t *st = (const BinaryTime_t *)sptr;
14 	long value;
15 
16 	if(!sptr) {
17 		ASN__CTFAIL(app_key, td, sptr,
18 			"%s: value not given (%s:%d)",
19 			td->name, __FILE__, __LINE__);
20 		return -1;
21 	}
22 
23 	/* Check if the sign bit is present */
24 	value = st->buf ? ((st->buf[0] & 0x80) ? -1 : 1) : 0;
25 
26 	if((value >= 0)) {
27 		/* Constraint check succeeded */
28 		return 0;
29 	} else {
30 		ASN__CTFAIL(app_key, td, sptr,
31 			"%s: constraint failed (%s:%d)",
32 			td->name, __FILE__, __LINE__);
33 		return -1;
34 	}
35 }
36 
37 /*
38  * This type is implemented using BinaryTime,
39  * so here we adjust the DEF accordingly.
40  */
41 static asn_oer_constraints_t asn_OER_type_BinarySigningTime_constr_1 CC_NOTUSED = {
42 	{ 0, 1 }	/* (0..MAX) */,
43 	-1};
44 static const ber_tlv_tag_t asn_DEF_BinarySigningTime_tags_1[] = {
45 	(ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
46 };
47 asn_TYPE_descriptor_t asn_DEF_BinarySigningTime = {
48 	"BinarySigningTime",
49 	"BinarySigningTime",
50 	&asn_OP_INTEGER,
51 	asn_DEF_BinarySigningTime_tags_1,
52 	sizeof(asn_DEF_BinarySigningTime_tags_1)
53 		/sizeof(asn_DEF_BinarySigningTime_tags_1[0]), /* 1 */
54 	asn_DEF_BinarySigningTime_tags_1,	/* Same as above */
55 	sizeof(asn_DEF_BinarySigningTime_tags_1)
56 		/sizeof(asn_DEF_BinarySigningTime_tags_1[0]), /* 1 */
57 	{ &asn_OER_type_BinarySigningTime_constr_1, 0, BinarySigningTime_constraint },
58 	0, 0,	/* No members */
59 	0	/* No specifics */
60 };
61 
62