Also, remove cyclical #includes, to further automate this.
#define SRC_ALGORITHM_H_
#include <openssl/x509.h>
+
#include "asn1/asn1c/AlgorithmIdentifier.h"
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
* Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ANY.h"
+
#include <assert.h>
#include <errno.h>
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/json_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
+
asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs = {
sizeof(ANY_t),
offsetof(ANY_t, _asn_ctx),
asn_enc_rval_t
ANY_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+ int flags, asn_app_consume_bytes_f *cb,
void *app_key) {
if(flags & XER_F_CANONICAL) {
/*
#ifndef ASN_TYPE_ANY_H
#define ASN_TYPE_ANY_H
-#include "asn1/asn1c/OCTET_STRING.h" /* Implemented via OCTET STRING type */
+#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/constraints.h"
typedef struct ANY {
uint8_t *buf; /* BER-encoded ANY contents */
#ifndef _ASId_H_
#define _ASId_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ASId */
typedef INTEGER_t ASId_t;
xer_type_encoder_f ASId_encode_xer;
#endif /* _ASId_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ASIdOrRange_H_
#define _ASIdOrRange_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ASId.h"
#include "asn1/asn1c/ASRange.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum ASIdOrRange_PR {
extern asn_TYPE_member_t asn_MBR_ASIdOrRange_1[2];
#endif /* _ASIdOrRange_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ASIdentifierChoice_H_
#define _ASIdentifierChoice_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/ASIdOrRange.h"
#include "asn1/asn1c/NULL.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/constr_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum ASIdentifierChoice_PR {
extern asn_CHOICE_specifics_t asn_SPC_ASIdentifierChoice_specs_1;
extern asn_TYPE_member_t asn_MBR_ASIdentifierChoice_1[2];
-/* Referred external types */
-#include "asn1/asn1c/ASIdOrRange.h"
-
#endif /* _ASIdentifierChoice_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ASIdentifiers_H_
#define _ASIdentifiers_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/ASIdentifierChoice.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct ASIdentifierChoice;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_ASIdentifiers;
-/* Referred external types */
-#include "asn1/asn1c/ASIdentifierChoice.h"
-
#endif /* _ASIdentifiers_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ASRange_H_
#define _ASRange_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ASId.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ASRange */
typedef struct ASRange {
extern asn_TYPE_member_t asn_MBR_ASRange_1[2];
#endif /* _ASRange_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _AlgorithmIdentifier_H_
#define _AlgorithmIdentifier_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* AlgorithmIdentifier */
typedef struct AlgorithmIdentifier {
extern asn_TYPE_member_t asn_MBR_AlgorithmIdentifier_1[2];
#endif /* _AlgorithmIdentifier_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _AttributeType_H_
#define _AttributeType_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* AttributeType */
typedef OBJECT_IDENTIFIER_t AttributeType_t;
xer_type_encoder_f AttributeType_encode_xer;
#endif /* _AttributeType_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _AttributeTypeAndValue_H_
#define _AttributeTypeAndValue_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/AttributeType.h"
#include "asn1/asn1c/AttributeValue.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* AttributeTypeAndValue */
typedef struct AttributeTypeAndValue {
extern asn_TYPE_member_t asn_MBR_AttributeTypeAndValue_1[2];
#endif /* _AttributeTypeAndValue_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _AttributeValue_H_
#define _AttributeValue_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* AttributeValue */
typedef ANY_t AttributeValue_t;
xer_type_encoder_f AttributeValue_encode_xer;
#endif /* _AttributeValue_H_ */
-#include "asn1/asn1c/asn_internal.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
+#include "asn1/asn1c/BIT_STRING.h"
+
#include <assert.h>
#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/BIT_STRING.h"
-#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/xer_encoder.h"
/*
* BIT STRING basic type description.
asn_enc_rval_t
BIT_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t er;
char scratch[128];
#ifndef _BIT_STRING_H_
#define _BIT_STRING_H_
-#include "asn1/asn1c/OCTET_STRING.h" /* Some help from OCTET STRING */
+#include "asn1/asn1c/OCTET_STRING.h"
typedef struct BIT_STRING_s {
uint8_t *buf; /* BIT STRING body */
* Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/asn_codecs_prim.h"
#include "asn1/asn1c/BOOLEAN.h"
+#include "asn1/asn1c/asn_codecs_prim.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
+#include "asn1/asn1c/der_encoder.h"
+
/*
* BOOLEAN basic type description.
*/
asn_enc_rval_t
BOOLEAN_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
- asn_app_consume_bytes_f *cb, void *app_key) {
+ int ilevel, int flags, asn_app_consume_bytes_f *cb, void *app_key) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er = {0, 0, 0};
#ifndef _BOOLEAN_H_
#define _BOOLEAN_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
/*
* The underlying integer may contain various values, but everything
#ifndef _BinarySigningTime_H_
#define _BinarySigningTime_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/BinaryTime.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* BinarySigningTime */
typedef BinaryTime_t BinarySigningTime_t;
xer_type_encoder_f BinarySigningTime_encode_xer;
#endif /* _BinarySigningTime_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _BinaryTime_H_
#define _BinaryTime_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* BinaryTime */
typedef INTEGER_t BinaryTime_t;
xer_type_encoder_f BinaryTime_encode_xer;
#endif /* _BinaryTime_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/CMSAttribute.h"
-#include <openssl/objects.h>
-#include "json_util.h"
+#include <openssl/obj_mac.h>
+
#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/MessageDigest.h"
#include "asn1/asn1c/SigningTime.h"
+#include "json_util.h"
json_t *
CMSAttribute_encode_json(const asn_TYPE_descriptor_t *td, const void *sptr)
#ifndef _CMSAttribute_H_
#define _CMSAttribute_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/CMSAttributeValue.h"
+#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/asn_SET_OF.h"
-#include "asn1/asn1c/constr_SET_OF.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CMSAttribute */
typedef struct CMSAttribute {
extern asn_TYPE_member_t asn_MBR_CMSAttribute_1[2];
#endif /* _CMSAttribute_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _CMSAttributeValue_H_
#define _CMSAttributeValue_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CMSAttributeValue */
typedef ANY_t CMSAttributeValue_t;
xer_type_encoder_f CMSAttributeValue_encode_xer;
#endif /* _CMSAttributeValue_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _CMSSubjectKeyIdentifier_H_
#define _CMSSubjectKeyIdentifier_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CMSSubjectKeyIdentifier */
typedef OCTET_STRING_t CMSSubjectKeyIdentifier_t;
xer_type_encoder_f CMSSubjectKeyIdentifier_encode_xer;
#endif /* _CMSSubjectKeyIdentifier_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _CMSVersion_H_
#define _CMSVersion_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum CMSVersion {
xer_type_encoder_f CMSVersion_encode_xer;
#endif /* _CMSVersion_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/CRL.h"
-#include <openssl/x509v3.h>
-#include <openssl/pem.h>
+#include <openssl/objects.h>
#include "extension.h"
#include "json_util.h"
#include "asn1/asn1c/Certificate.h"
-#include <openssl/x509v3.h>
+#include <openssl/objects.h>
#include "extension.h"
#include "json_util.h"
#ifndef SRC_ASN1_ASN1C_CERTIFICATE_H_
#define SRC_ASN1_ASN1C_CERTIFICATE_H_
-#include <jansson.h>
#include <openssl/bio.h>
+
#include "asn1/asn1c/ANY.h"
json_t *Certificate_any2json(ANY_t *);
#ifndef _CertificateList_H_
#define _CertificateList_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/TBSCertList.h"
#include "asn1/asn1c/AlgorithmIdentifier.h"
#include "asn1/asn1c/BIT_STRING.h"
+#include "asn1/asn1c/TBSCertList.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CertificateList */
typedef struct CertificateList {
extern asn_TYPE_member_t asn_MBR_CertificateList_1[3];
#endif /* _CertificateList_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _CertificateSerialNumber_H_
#define _CertificateSerialNumber_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CertificateSerialNumber */
typedef INTEGER_t CertificateSerialNumber_t;
xer_type_encoder_f CertificateSerialNumber_encode_xer;
#endif /* _CertificateSerialNumber_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/CertificateSet.h"
-#include "json_util.h"
#include "asn1/asn1c/Certificate.h"
+#include "json_util.h"
static json_t *
CertificateSet_encode_json(const struct asn_TYPE_descriptor_s *td,
#ifndef _CertificateSet_H_
#define _CertificateSet_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ANY.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* CertificateSet */
typedef struct CertificateSet {
extern asn_TYPE_member_t asn_MBR_CertificateSet_1[1];
#endif /* _CertificateSet_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ContentInfo.h"
-#include <openssl/objects.h>
-#include "json_util.h"
+#include <openssl/obj_mac.h>
+
#include "asn1/asn1c/SignedData.h"
+#include "json_util.h"
json_t *
ContentInfo_encode_json(const asn_TYPE_descriptor_t *td, const void *sptr)
#ifndef _ContentInfo_H_
#define _ContentInfo_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ContentInfo */
typedef struct ContentInfo {
extern asn_TYPE_descriptor_t asn_DEF_ContentInfo;
#endif /* _ContentInfo_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ContentType_H_
#define _ContentType_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ContentType */
typedef OBJECT_IDENTIFIER_t ContentType_t;
xer_type_encoder_f ContentType_encode_xer;
#endif /* _ContentType_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ContentTypePKCS7_H_
#define _ContentTypePKCS7_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ContentTypePKCS7 */
typedef OCTET_STRING_t ContentTypePKCS7_t;
xer_type_encoder_f ContentTypePKCS7_encode_xer;
#endif /* _ContentTypePKCS7_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _Countersignature_H_
#define _Countersignature_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/SignerInfo.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Countersignature */
typedef SignerInfo_t Countersignature_t;
xer_type_encoder_f Countersignature_encode_xer;
#endif /* _Countersignature_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _DigestAlgorithmIdentifier_H_
#define _DigestAlgorithmIdentifier_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/AlgorithmIdentifier.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* DigestAlgorithmIdentifier */
typedef AlgorithmIdentifier_t DigestAlgorithmIdentifier_t;
xer_type_encoder_f DigestAlgorithmIdentifier_encode_xer;
#endif /* _DigestAlgorithmIdentifier_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _DigestAlgorithmIdentifiers_H_
#define _DigestAlgorithmIdentifiers_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/DigestAlgorithmIdentifier.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct DigestAlgorithmIdentifier;
extern asn_SET_OF_specifics_t asn_SPC_DigestAlgorithmIdentifiers_specs_1;
extern asn_TYPE_member_t asn_MBR_DigestAlgorithmIdentifiers_1[1];
-/* Referred external types */
-#include "asn1/asn1c/DigestAlgorithmIdentifier.h"
-
#endif /* _DigestAlgorithmIdentifiers_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _DistinguishedName_H_
#define _DistinguishedName_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/RDNSequence.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* DistinguishedName */
typedef RDNSequence_t DistinguishedName_t;
xer_type_encoder_f DistinguishedName_encode_xer;
#endif /* _DistinguishedName_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/EncapsulatedContentInfo.h"
-#include "nid.h"
-#include "json_util.h"
#include "asn1/asn1c/Manifest.h"
#include "asn1/asn1c/RouteOriginAttestation.h"
+#include "json_util.h"
+#include "nid.h"
json_t *
EncapsulatedContentInfo_encode_json(const asn_TYPE_descriptor_t *td,
#ifndef _EncapsulatedContentInfo_H_
#define _EncapsulatedContentInfo_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/OCTET_STRING.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* EncapsulatedContentInfo */
typedef struct EncapsulatedContentInfo {
extern asn_TYPE_member_t asn_MBR_EncapsulatedContentInfo_1[2];
#endif /* _EncapsulatedContentInfo_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _EncapsulatedContentInfoPKCS7_H_
#define _EncapsulatedContentInfoPKCS7_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* EncapsulatedContentInfoPKCS7 */
typedef struct EncapsulatedContentInfoPKCS7 {
extern asn_TYPE_member_t asn_MBR_EncapsulatedContentInfoPKCS7_1[2];
#endif /* _EncapsulatedContentInfoPKCS7_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/Extension.h"
+#include "asn1/asn1c/asn_internal.h"
+
static int asn_DFL_3_cmp_0(const void *sptr) {
const BOOLEAN_t *st = sptr;
#ifndef _Extension_H_
#define _Extension_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/BOOLEAN.h"
+#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/OCTET_STRING.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Extension */
typedef struct Extension {
extern asn_TYPE_member_t asn_MBR_Extension_1[3];
#endif /* _Extension_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _Extensions_H_
#define _Extensions_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/Extension.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct Extension;
extern asn_SET_OF_specifics_t asn_SPC_Extensions_specs_1;
extern asn_TYPE_member_t asn_MBR_Extensions_1[1];
-/* Referred external types */
-#include "asn1/asn1c/Extension.h"
-
#endif /* _Extensions_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _FileAndHash_H_
#define _FileAndHash_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/IA5String.h"
#include "asn1/asn1c/BIT_STRING.h"
+#include "asn1/asn1c/IA5String.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* FileAndHash */
typedef struct FileAndHash {
extern asn_TYPE_member_t asn_MBR_FileAndHash_1[2];
#endif /* _FileAndHash_H_ */
-#include "asn1/asn1c/asn_internal.h"
#define _REENTRANT /* for Sun */
#define __EXTENSIONS__ /* for Sun */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/GeneralizedTime.h"
#include <assert.h>
#include <errno.h>
+
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/xer_encoder.h"
#include "json_util.h"
#define ATZVARS do { \
asn_enc_rval_t
GeneralizedTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
if(flags & XER_F_CANONICAL) {
GeneralizedTime_t *gt;
#ifndef _GeneralizedTime_H_
#define _GeneralizedTime_H_
-#include "asn1/asn1c/OCTET_STRING.h"
#include <sys/stat.h>
#include <time.h>
+#include "asn1/asn1c/OCTET_STRING.h"
+
typedef OCTET_STRING_t GeneralizedTime_t; /* Implemented via OCTET STRING */
extern asn_TYPE_descriptor_t asn_DEF_GeneralizedTime;
* Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/IA5String.h"
/*
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/INTEGER.h"
#include <assert.h>
#include <errno.h>
+#include "asn1/asn1c/asn_codecs_prim.h"
+#include "asn1/asn1c/asn_internal.h"
#include "json_util.h"
-#include "asn1/asn1c/asn_codecs_prim.h" /* Encoder and decoder of a primitive type */
/*
* INTEGER basic type description.
asn_enc_rval_t
INTEGER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
const INTEGER_t *st = (const INTEGER_t *)sptr;
asn_enc_rval_t er;
#ifndef _INTEGER_H_
#define _INTEGER_H_
-#include "asn1/asn1c/asn_application.h"
#include "asn1/asn1c/asn_codecs_prim.h"
+#include "asn1/asn1c/constr_TYPE.h"
+#include "asn1/asn1c/constraints.h"
typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;
#ifndef _IPAddrBlocks_H_
#define _IPAddrBlocks_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/IPAddressFamily.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct IPAddressFamily;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_IPAddrBlocks;
-/* Referred external types */
-#include "asn1/asn1c/IPAddressFamily.h"
-
#endif /* _IPAddrBlocks_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IPAddress_H_
#define _IPAddress_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/BIT_STRING.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* IPAddress */
typedef BIT_STRING_t IPAddress_t;
xer_type_encoder_f IPAddress_encode_xer;
#endif /* _IPAddress_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IPAddressChoice_H_
#define _IPAddressChoice_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/IPAddressOrRange.h"
#include "asn1/asn1c/NULL.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/constr_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum IPAddressChoice_PR {
extern asn_CHOICE_specifics_t asn_SPC_IPAddressChoice_specs_1;
extern asn_TYPE_member_t asn_MBR_IPAddressChoice_1[2];
-/* Referred external types */
-#include "asn1/asn1c/IPAddressOrRange.h"
-
#endif /* _IPAddressChoice_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IPAddressFamily_H_
#define _IPAddressFamily_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/OCTET_STRING.h"
#include "asn1/asn1c/IPAddressChoice.h"
+#include "asn1/asn1c/OCTET_STRING.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* IPAddressFamily */
typedef struct IPAddressFamily {
extern asn_TYPE_member_t asn_MBR_IPAddressFamily_1[2];
#endif /* _IPAddressFamily_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IPAddressOrRange_H_
#define _IPAddressOrRange_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/IPAddress.h"
#include "asn1/asn1c/IPAddressRange.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum IPAddressOrRange_PR {
extern asn_TYPE_member_t asn_MBR_IPAddressOrRange_1[2];
#endif /* _IPAddressOrRange_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IPAddressRange_H_
#define _IPAddressRange_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/IPAddress.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* IPAddressRange */
typedef struct IPAddressRange {
extern asn_TYPE_member_t asn_MBR_IPAddressRange_1[2];
#endif /* _IPAddressRange_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _IssuerAndSerialNumber_H_
#define _IssuerAndSerialNumber_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/Name.h"
#include "asn1/asn1c/CertificateSerialNumber.h"
+#include "asn1/asn1c/Name.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* IssuerAndSerialNumber */
typedef struct IssuerAndSerialNumber {
extern asn_TYPE_member_t asn_MBR_IssuerAndSerialNumber_1[2];
#endif /* _IssuerAndSerialNumber_H_ */
-#include "asn1/asn1c/asn_internal.h"
ASN_MODULE_SRCS+=asn1/asn1c/constr_SEQUENCE_OF.c
ASN_MODULE_HDRS+=asn1/asn1c/constr_SET_OF.h
ASN_MODULE_SRCS+=asn1/asn1c/constr_SET_OF.c
-ASN_MODULE_HDRS+=asn1/asn1c/asn_application.h
-ASN_MODULE_SRCS+=asn1/asn1c/asn_application.c
ASN_MODULE_HDRS+=asn1/asn1c/asn_ioc.h
ASN_MODULE_HDRS+=asn1/asn1c/asn_system.h
ASN_MODULE_HDRS+=asn1/asn1c/asn_codecs.h
#include "asn1/asn1c/Manifest.h"
+#include "asn1/asn1c/asn_internal.h"
+
static int
memb_manifestNumber_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
#ifndef _Manifest_H_
#define _Manifest_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/FileAndHash.h"
#include "asn1/asn1c/GeneralizedTime.h"
+#include "asn1/asn1c/INTEGER.h"
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/constr_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct FileAndHash;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_Manifest;
-/* Referred external types */
-#include "asn1/asn1c/FileAndHash.h"
-
#endif /* _Manifest_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _MessageDigest_H_
#define _MessageDigest_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* MessageDigest */
typedef OCTET_STRING_t MessageDigest_t;
xer_type_encoder_f MessageDigest_encode_xer;
#endif /* _MessageDigest_H_ */
-#include "asn1/asn1c/asn_internal.h"
* Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/asn_codecs_prim.h"
#include "asn1/asn1c/NULL.h"
+#include "asn1/asn1c/asn_codecs_prim.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
+#include "asn1/asn1c/der_encoder.h"
+
/*
* NULL basic type description.
*/
asn_enc_rval_t
NULL_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+ int flags, asn_app_consume_bytes_f *cb,
void *app_key) {
asn_enc_rval_t er;
#ifndef ASN_TYPE_NULL_H
#define ASN_TYPE_NULL_H
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
/*
* The value of the NULL type is meaningless.
#ifndef _Name_H_
#define _Name_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/RDNSequence.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum Name_PR {
extern asn_TYPE_member_t asn_MBR_Name_1[1];
#endif /* _Name_H_ */
-#include "asn1/asn1c/asn_internal.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include <assert.h>
#include <errno.h>
+#include <openssl/asn1.h>
+#include <openssl/obj_mac.h>
#include <openssl/objects.h>
-#include "json_util.h"
#include "asn1/asn1c/INTEGER.h"
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "json_util.h"
/*
* OBJECT IDENTIFIER basic type description.
asn_enc_rval_t
OBJECT_IDENTIFIER_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
asn_enc_rval_t er;
#ifndef _OBJECT_IDENTIFIER_H_
#define _OBJECT_IDENTIFIER_H_
-#include <stdbool.h>
-#include "asn1/asn1c/asn_application.h"
-#include "asn1/asn1c/asn_codecs_prim.h"
+#include <netdb.h>
+
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/asn_codecs_prim.h"
+#include "asn1/asn1c/constr_TYPE.h"
typedef uint32_t asn_oid_arc_t;
#define ASN_OID_ARC_MAX (~((asn_oid_arc_t)0))
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/OCTET_STRING.h"
#include <assert.h>
#include <errno.h>
#include "alloc.h"
+#include "asn1/asn1c/BIT_STRING.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/json_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
#include "json_util.h"
-#include "asn1/asn1c/BIT_STRING.h" /* for .bits_unused member */
/*
* OCTET STRING basic type description.
asn_enc_rval_t
OCTET_STRING_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
const char * const h2c = "0123456789ABCDEF";
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
asn_enc_rval_t
OCTET_STRING_encode_xer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
asn_enc_rval_t er;
#ifndef _OCTET_STRING_H_
#define _OCTET_STRING_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
+#include "asn1/asn1c/constraints.h"
/*
* Note: Though this sometimes represents an actual string, I don't see any
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/OPEN_TYPE.h"
+
+#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constr_CHOICE.h"
-#include <assert.h>
asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
OPEN_TYPE_free,
#ifndef ASN_OPEN_TYPE_H
#define ASN_OPEN_TYPE_H
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
#define OPEN_TYPE_free CHOICE_free
#define OPEN_TYPE_print CHOICE_print
#ifndef _OtherRevocationInfoFormat_H_
#define _OtherRevocationInfoFormat_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* OtherRevocationInfoFormat */
typedef struct OtherRevocationInfoFormat {
extern asn_TYPE_member_t asn_MBR_OtherRevocationInfoFormat_1[2];
#endif /* _OtherRevocationInfoFormat_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _RDNSequence_H_
#define _RDNSequence_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/RelativeDistinguishedName.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct RelativeDistinguishedName;
extern asn_SET_OF_specifics_t asn_SPC_RDNSequence_specs_1;
extern asn_TYPE_member_t asn_MBR_RDNSequence_1[1];
-/* Referred external types */
-#include "asn1/asn1c/RelativeDistinguishedName.h"
-
#endif /* _RDNSequence_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ROAIPAddress_H_
#define _ROAIPAddress_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/IPAddress.h"
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/IPAddress.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* ROAIPAddress */
typedef struct ROAIPAddress {
extern asn_TYPE_member_t asn_MBR_ROAIPAddress_1[2];
#endif /* _ROAIPAddress_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _ROAIPAddressFamily_H_
#define _ROAIPAddressFamily_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/ROAIPAddress.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/constr_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct ROAIPAddress;
extern asn_SEQUENCE_specifics_t asn_SPC_ROAIPAddressFamily_specs_1;
extern asn_TYPE_member_t asn_MBR_ROAIPAddressFamily_1[2];
-/* Referred external types */
-#include "asn1/asn1c/ROAIPAddress.h"
-
#endif /* _ROAIPAddressFamily_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _RelativeDistinguishedName_H_
#define _RelativeDistinguishedName_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/AttributeTypeAndValue.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct AttributeTypeAndValue;
extern asn_SET_OF_specifics_t asn_SPC_RelativeDistinguishedName_specs_1;
extern asn_TYPE_member_t asn_MBR_RelativeDistinguishedName_1[1];
-/* Referred external types */
-#include "asn1/asn1c/AttributeTypeAndValue.h"
-
#endif /* _RelativeDistinguishedName_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _RevocationInfoChoice_H_
#define _RevocationInfoChoice_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/CertificateList.h"
#include "asn1/asn1c/OtherRevocationInfoFormat.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum RevocationInfoChoice_PR {
extern asn_TYPE_member_t asn_MBR_RevocationInfoChoice_1[2];
#endif /* _RevocationInfoChoice_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _RevocationInfoChoices_H_
#define _RevocationInfoChoices_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/RevocationInfoChoice.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct RevocationInfoChoice;
extern asn_SET_OF_specifics_t asn_SPC_RevocationInfoChoices_specs_1;
extern asn_TYPE_member_t asn_MBR_RevocationInfoChoices_1[1];
-/* Referred external types */
-#include "asn1/asn1c/RevocationInfoChoice.h"
-
#endif /* _RevocationInfoChoices_H_ */
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/RouteOriginAttestation.h"
+#include "asn1/asn1c/asn_internal.h"
+
static int
memb_ipAddrBlocks_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
#ifndef _RouteOriginAttestation_H_
#define _RouteOriginAttestation_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/INTEGER.h"
#include "asn1/asn1c/ASId.h"
+#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/ROAIPAddressFamily.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/constr_SEQUENCE_OF.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct ROAIPAddressFamily;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_RouteOriginAttestation;
-/* Referred external types */
-#include "asn1/asn1c/ROAIPAddressFamily.h"
-
#endif /* _RouteOriginAttestation_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignatureAlgorithmIdentifier_H_
#define _SignatureAlgorithmIdentifier_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/AlgorithmIdentifier.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* SignatureAlgorithmIdentifier */
typedef AlgorithmIdentifier_t SignatureAlgorithmIdentifier_t;
xer_type_encoder_f SignatureAlgorithmIdentifier_encode_xer;
#endif /* _SignatureAlgorithmIdentifier_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignatureValue_H_
#define _SignatureValue_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/OCTET_STRING.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* SignatureValue */
typedef OCTET_STRING_t SignatureValue_t;
xer_type_encoder_f SignatureValue_encode_xer;
#endif /* _SignatureValue_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignedAttributes_H_
#define _SignedAttributes_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/CMSAttribute.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct CMSAttribute;
extern asn_SET_OF_specifics_t asn_SPC_SignedAttributes_specs_1;
extern asn_TYPE_member_t asn_MBR_SignedAttributes_1[1];
-/* Referred external types */
-#include "asn1/asn1c/CMSAttribute.h"
-
#endif /* _SignedAttributes_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignedData_H_
#define _SignedData_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/CMSVersion.h"
+#include "asn1/asn1c/CertificateSet.h"
#include "asn1/asn1c/DigestAlgorithmIdentifiers.h"
#include "asn1/asn1c/EncapsulatedContentInfo.h"
+#include "asn1/asn1c/RevocationInfoChoices.h"
#include "asn1/asn1c/SignerInfos.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct CertificateSet;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_SignedData;
-/* Referred external types */
-#include "asn1/asn1c/CertificateSet.h"
-#include "asn1/asn1c/RevocationInfoChoices.h"
-
#endif /* _SignedData_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignedDataPKCS7_H_
#define _SignedDataPKCS7_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/CMSVersion.h"
+#include "asn1/asn1c/CertificateSet.h"
#include "asn1/asn1c/DigestAlgorithmIdentifiers.h"
#include "asn1/asn1c/EncapsulatedContentInfoPKCS7.h"
+#include "asn1/asn1c/RevocationInfoChoices.h"
#include "asn1/asn1c/SignerInfos.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct CertificateSet;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_SignedDataPKCS7;
-/* Referred external types */
-#include "asn1/asn1c/CertificateSet.h"
-#include "asn1/asn1c/RevocationInfoChoices.h"
-
#endif /* _SignedDataPKCS7_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignerIdentifier_H_
#define _SignerIdentifier_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/IssuerAndSerialNumber.h"
#include "asn1/asn1c/CMSSubjectKeyIdentifier.h"
+#include "asn1/asn1c/IssuerAndSerialNumber.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum SignerIdentifier_PR {
extern asn_TYPE_member_t asn_MBR_SignerIdentifier_1[2];
#endif /* _SignerIdentifier_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignerInfo_H_
#define _SignerInfo_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/CMSVersion.h"
-#include "asn1/asn1c/SignerIdentifier.h"
#include "asn1/asn1c/DigestAlgorithmIdentifier.h"
#include "asn1/asn1c/SignatureAlgorithmIdentifier.h"
#include "asn1/asn1c/SignatureValue.h"
+#include "asn1/asn1c/SignedAttributes.h"
+#include "asn1/asn1c/SignerIdentifier.h"
+#include "asn1/asn1c/UnsignedAttributes.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct SignedAttributes;
extern asn_SEQUENCE_specifics_t asn_SPC_SignerInfo_specs_1;
extern asn_TYPE_member_t asn_MBR_SignerInfo_1[7];
-/* Referred external types */
-#include "asn1/asn1c/SignedAttributes.h"
-#include "asn1/asn1c/UnsignedAttributes.h"
-
#endif /* _SignerInfo_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SignerInfos_H_
#define _SignerInfos_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/SignerInfo.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct SignerInfo;
extern asn_SET_OF_specifics_t asn_SPC_SignerInfos_specs_1;
extern asn_TYPE_member_t asn_MBR_SignerInfos_1[1];
-/* Referred external types */
-#include "asn1/asn1c/SignerInfo.h"
-
#endif /* _SignerInfos_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _SigningTime_H_
#define _SigningTime_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/Time.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* SigningTime */
typedef Time_t SigningTime_t;
xer_type_encoder_f SigningTime_encode_xer;
#endif /* _SigningTime_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _TBSCertList_H_
#define _TBSCertList_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/Version.h"
#include "asn1/asn1c/AlgorithmIdentifier.h"
+#include "asn1/asn1c/CertificateSerialNumber.h"
+#include "asn1/asn1c/Extensions.h"
#include "asn1/asn1c/Name.h"
#include "asn1/asn1c/Time.h"
+#include "asn1/asn1c/Version.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
-#include "asn1/asn1c/CertificateSerialNumber.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct Time;
extern asn_SEQUENCE_specifics_t asn_SPC_TBSCertList_specs_1;
extern asn_TYPE_member_t asn_MBR_TBSCertList_1[7];
-/* Referred external types */
-#include "asn1/asn1c/Time.h"
-#include "asn1/asn1c/Extensions.h"
-
#endif /* _TBSCertList_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _Time_H_
#define _Time_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
-#include "asn1/asn1c/UTCTime.h"
#include "asn1/asn1c/GeneralizedTime.h"
+#include "asn1/asn1c/UTCTime.h"
#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum Time_PR {
extern asn_TYPE_member_t asn_MBR_Time_1[2];
#endif /* _Time_H_ */
-#include "asn1/asn1c/asn_internal.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/UTCTime.h"
#include <assert.h>
#include <errno.h>
-#include "json_util.h"
#include "asn1/asn1c/GeneralizedTime.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/xer_encoder.h"
+#include "json_util.h"
#ifndef ASN___INTERNAL_TEST_MODE
asn_enc_rval_t
UTCTime_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
if(flags & XER_F_CANONICAL) {
asn_enc_rval_t rv;
#ifndef _UTCTime_H_
#define _UTCTime_H_
-#include "asn1/asn1c/OCTET_STRING.h"
#include <sys/stat.h>
#include <time.h>
+#include "asn1/asn1c/OCTET_STRING.h"
+
typedef OCTET_STRING_t UTCTime_t; /* Implemented via OCTET STRING */
extern asn_TYPE_descriptor_t asn_DEF_UTCTime;
#ifndef _UnsignedAttributes_H_
#define _UnsignedAttributes_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
+#include "asn1/asn1c/CMSAttribute.h"
#include "asn1/asn1c/asn_SET_OF.h"
#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Forward declarations */
struct CMSAttribute;
extern asn_SET_OF_specifics_t asn_SPC_UnsignedAttributes_specs_1;
extern asn_TYPE_member_t asn_MBR_UnsignedAttributes_1[1];
-/* Referred external types */
-#include "asn1/asn1c/CMSAttribute.h"
-
#endif /* _UnsignedAttributes_H_ */
-#include "asn1/asn1c/asn_internal.h"
#ifndef _Version_H_
#define _Version_H_
-
-#include "asn1/asn1c/asn_application.h"
-
-/* Including external dependencies */
#include "asn1/asn1c/INTEGER.h"
+#include "asn1/asn1c/constr_TYPE.h"
/* Dependencies */
typedef enum Version {
xer_type_encoder_f Version_encode_xer;
#endif /* _Version_H_ */
-#include "asn1/asn1c/asn_internal.h"
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
typedef A_SEQUENCE_OF(void) asn_sequence;
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/asn_SET_OF.h"
+
#include <errno.h>
+#include "asn1/asn1c/asn_internal.h"
+
/*
* Add another element into the set.
*/
+++ /dev/null
-/*
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/asn_application.h"
-#include <assert.h>
-#include <errno.h>
-
-static asn_enc_rval_t asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
- enum asn_transfer_syntax syntax,
- const asn_TYPE_descriptor_t *td,
- const void *sptr,
- asn_app_consume_bytes_f *callback,
- void *callback_key);
-
-
-struct callback_count_bytes_key {
- asn_app_consume_bytes_f *callback;
- void *callback_key;
- size_t computed_size;
-};
-
-/*
- * Encoder which just counts bytes that come through it.
- */
-static int
-callback_count_bytes_cb(const void *data, size_t size, void *keyp) {
- struct callback_count_bytes_key *key = keyp;
- int ret;
-
- ret = key->callback(data, size, key->callback_key);
- if(ret >= 0) {
- key->computed_size += size;
- }
-
- return ret;
-}
-
-struct overrun_encoder_key {
- void *buffer;
- size_t buffer_size;
- size_t computed_size;
-};
-
-struct dynamic_encoder_key {
- void *buffer;
- size_t buffer_size;
- size_t computed_size;
-};
-
-struct callback_failure_catch_key {
- asn_app_consume_bytes_f *callback;
- void *callback_key;
- int callback_failed;
-};
-
-/*
- * Encoder which doesn't stop counting bytes
- * even if it reaches the end of the buffer.
- */
-static int
-overrun_encoder_cb(const void *data, size_t size, void *keyp) {
- struct overrun_encoder_key *key = keyp;
-
- if(key->computed_size + size > key->buffer_size) {
- /*
- * Avoid accident on the next call:
- * stop adding bytes to the buffer.
- */
- key->buffer_size = 0;
- } else {
- memcpy((char *)key->buffer + key->computed_size, data, size);
- }
- key->computed_size += size;
-
- return 0;
-}
-
-/*
- * Encoder which dynamically allocates output, and continues
- * to count even if allocation failed.
- */
-static int
-dynamic_encoder_cb(const void *data, size_t size, void *keyp) {
- struct dynamic_encoder_key *key = keyp;
-
- if(key->buffer) {
- if(key->computed_size + size >= key->buffer_size) {
- void *p;
- size_t new_size = key->buffer_size;
-
- do {
- new_size *= 2;
- } while(new_size <= key->computed_size + size);
-
- p = REALLOC(key->buffer, new_size);
- if(p) {
- key->buffer = p;
- key->buffer_size = new_size;
- } else {
- FREEMEM(key->buffer);
- key->buffer = 0;
- key->buffer_size = 0;
- key->computed_size += size;
- return 0;
- }
- }
- memcpy((char *)key->buffer + key->computed_size, data, size);
- }
-
- key->computed_size += size;
-
- return 0;
-}
-
-/*
- * Encoder which help convert the application level encoder failure into EIO.
- */
-static int
-callback_failure_catch_cb(const void *data, size_t size, void *keyp) {
- struct callback_failure_catch_key *key = keyp;
- int ret;
-
- ret = key->callback(data, size, key->callback_key);
- if(ret < 0) {
- key->callback_failed = 1;
- }
-
- return ret;
-}
-
-asn_enc_rval_t
-asn_encode(const asn_codec_ctx_t *opt_codec_ctx,
- enum asn_transfer_syntax syntax, const asn_TYPE_descriptor_t *td,
- const void *sptr, asn_app_consume_bytes_f *callback, void *callback_key) {
- struct callback_failure_catch_key cb_key;
- asn_enc_rval_t er;
-
- if(!callback) {
- errno = EINVAL;
- ASN__ENCODE_FAILED;
- }
-
- cb_key.callback = callback;
- cb_key.callback_key = callback_key;
- cb_key.callback_failed = 0;
-
- er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
- callback_failure_catch_cb, &cb_key);
- if(cb_key.callback_failed) {
- assert(er.encoded == -1);
- assert(errno == EBADF);
- errno = EIO;
- }
-
- return er;
-}
-
-asn_enc_rval_t
-asn_encode_to_buffer(const asn_codec_ctx_t *opt_codec_ctx,
- enum asn_transfer_syntax syntax,
- const asn_TYPE_descriptor_t *td, const void *sptr,
- void *buffer, size_t buffer_size) {
- struct overrun_encoder_key buf_key;
- asn_enc_rval_t er;
-
- if(buffer_size > 0 && !buffer) {
- errno = EINVAL;
- ASN__ENCODE_FAILED;
- }
-
- buf_key.buffer = buffer;
- buf_key.buffer_size = buffer_size;
- buf_key.computed_size = 0;
-
- er = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
- overrun_encoder_cb, &buf_key);
-
- if(er.encoded >= 0 && (size_t)er.encoded != buf_key.computed_size) {
- ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE
- " yet produced %" ASN_PRI_SIZE " bytes",
- er.encoded, buf_key.computed_size);
- assert(er.encoded < 0 || (size_t)er.encoded == buf_key.computed_size);
- }
-
- return er;
-}
-
-asn_encode_to_new_buffer_result_t
-asn_encode_to_new_buffer(const asn_codec_ctx_t *opt_codec_ctx,
- enum asn_transfer_syntax syntax,
- const asn_TYPE_descriptor_t *td, const void *sptr) {
- struct dynamic_encoder_key buf_key;
- asn_encode_to_new_buffer_result_t res;
-
- buf_key.buffer_size = 16;
- buf_key.buffer = MALLOC(buf_key.buffer_size);
- buf_key.computed_size = 0;
-
- res.result = asn_encode_internal(opt_codec_ctx, syntax, td, sptr,
- dynamic_encoder_cb, &buf_key);
-
- if(res.result.encoded >= 0
- && (size_t)res.result.encoded != buf_key.computed_size) {
- ASN_DEBUG("asn_encode() returned %" ASN_PRI_SSIZE
- " yet produced %" ASN_PRI_SIZE " bytes",
- res.result.encoded, buf_key.computed_size);
- assert(res.result.encoded < 0
- || (size_t)res.result.encoded == buf_key.computed_size);
- }
-
- res.buffer = buf_key.buffer;
-
- /* 0-terminate just in case. */
- if(res.buffer) {
- assert(buf_key.computed_size < buf_key.buffer_size);
- ((char *)res.buffer)[buf_key.computed_size] = '\0';
- }
-
- return res;
-}
-
-static asn_enc_rval_t
-asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
- enum asn_transfer_syntax syntax,
- const asn_TYPE_descriptor_t *td, const void *sptr,
- asn_app_consume_bytes_f *callback, void *callback_key) {
- asn_enc_rval_t er;
-
- (void)opt_codec_ctx; /* Parameters are not checked on encode yet. */
-
- if(!td || !sptr) {
- errno = EINVAL;
- ASN__ENCODE_FAILED;
- }
-
- switch(syntax) {
- case ATS_NONSTANDARD_PLAINTEXT:
- if(td->op->print_struct) {
- struct callback_count_bytes_key cb_key;
- cb_key.callback = callback;
- cb_key.callback_key = callback_key;
- cb_key.computed_size = 0;
- if(td->op->print_struct(td, sptr, 1, callback_count_bytes_cb,
- &cb_key)
- < 0
- || callback_count_bytes_cb("\n", 1, &cb_key) < 0) {
- errno = EBADF; /* Structure has incorrect form. */
- er.encoded = -1;
- er.failed_type = td;
- er.structure_ptr = sptr;
- } else {
- er.encoded = cb_key.computed_size;
- er.failed_type = 0;
- er.structure_ptr = 0;
- }
- } else {
- errno = ENOENT; /* Transfer syntax is not defined for this type. */
- ASN__ENCODE_FAILED;
- }
- break;
-
- case ATS_BER:
- /* BER is a superset of DER. */
- /* Fall through. */
- case ATS_DER:
- if(td->op->der_encoder) {
- er = der_encode(td, sptr, callback, callback_key);
- if(er.encoded == -1) {
- if(er.failed_type && er.failed_type->op->der_encoder) {
- errno = EBADF; /* Structure has incorrect form. */
- } else {
- errno = ENOENT; /* DER is not defined for this type. */
- }
- }
- } else {
- errno = ENOENT; /* Transfer syntax is not defined for this type. */
- ASN__ENCODE_FAILED;
- }
- break;
- case ATS_CER:
- errno = ENOENT; /* Transfer syntax is not defined for any type. */
- ASN__ENCODE_FAILED;
-
- default:
- errno = ENOENT;
- ASN__ENCODE_FAILED;
- }
-
- return er;
-}
+++ /dev/null
-/*-
- * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-/*
- * Application-level ASN.1 callbacks.
- */
-#ifndef ASN_APPLICATION_H
-#define ASN_APPLICATION_H
-
-#include "asn1/asn1c/asn_system.h" /* for platform-dependent types */
-#include "asn1/asn1c/asn_codecs.h" /* for ASN.1 codecs specifics */
-
-/*
- * A selection of ASN.1 Transfer Syntaxes to use with generalized
- * encoders and decoders declared further in this .h file.
- */
-enum asn_transfer_syntax {
- /* Avoid appearance of a default transfer syntax. */
- ATS_INVALID = 0,
- /* Plaintext output (not conforming to any standard), for debugging. */
- ATS_NONSTANDARD_PLAINTEXT,
- /*
- * X.690:
- * BER: Basic Encoding Rules.
- * DER: Distinguished Encoding Rules.
- * CER: Canonical Encoding Rules.
- * DER and CER are more strict variants of BER.
- */
- ATS_BER,
- ATS_DER,
- ATS_CER, /* Only decoding is supported */
-};
-
-/*
- * A generic encoder for any supported transfer syntax.
- * RETURN VALUES:
- * The (.encoded) field of the return value is REDEFINED to mean the following:
- * >=0: The computed size of the encoded data. Can exceed the (buffer_size).
- * -1: Error encoding the structure. See the error code in (errno):
- * EINVAL: Incorrect parameters to the function, such as NULLs.
- * ENOENT: Encoding transfer syntax is not defined (for this type).
- * EBADF: The structure has invalid form or content constraint failed.
- * The (.failed_type) and (.structure_ptr) MIGHT be set to the appropriate
- * values at the place of failure, if at all possible.
- * WARNING: The (.encoded) field of the return value can exceed the buffer_size.
- * This is similar to snprintf(3) contract which might return values
- * greater than the buffer size.
- */
-asn_enc_rval_t asn_encode_to_buffer(
- const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */
- enum asn_transfer_syntax,
- const struct asn_TYPE_descriptor_s *type_to_encode,
- const void *structure_to_encode, void *buffer, size_t buffer_size);
-
-/*
- * A variant of asn_encode_to_buffer() with automatically allocated buffer.
- * RETURN VALUES:
- * On success, returns a newly allocated (.buffer) containing the whole message.
- * The message size is returned in (.result.encoded).
- * On failure:
- * (.buffer) is NULL,
- * (.result.encoded) as in asn_encode_to_buffer(),
- * The errno codes as in asn_encode_to_buffer(), plus the following:
- * ENOMEM: Memory allocation failed due to system or internal limits.
- * The user is responsible for freeing the (.buffer).
- */
-typedef struct asn_encode_to_new_buffer_result_s {
- void *buffer; /* NULL if failed to encode. */
- asn_enc_rval_t result;
-} asn_encode_to_new_buffer_result_t;
-asn_encode_to_new_buffer_result_t asn_encode_to_new_buffer(
- const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */
- enum asn_transfer_syntax,
- const struct asn_TYPE_descriptor_s *type_to_encode,
- const void *structure_to_encode);
-
-
-/*
- * Generic type of an application-defined callback to return various
- * types of data to the application.
- * EXPECTED RETURN VALUES:
- * -1: Failed to consume bytes. Abort the mission.
- * Non-negative return values indicate success, and ignored.
- */
-typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size,
- void *application_specific_key);
-
-
-/*
- * A generic encoder for any supported transfer syntax.
- * Returns the comprehensive encoding result descriptor (see asn_codecs.h).
- * RETURN VALUES:
- * The negative (.encoded) field of the return values is accompanied with the
- * following error codes (errno):
- * EINVAL: Incorrect parameters to the function, such as NULLs.
- * ENOENT: Encoding transfer syntax is not defined (for this type).
- * EBADF: The structure has invalid form or content constraint failed.
- * EIO: The (callback) has returned negative value during encoding.
- */
-asn_enc_rval_t asn_encode(
- const asn_codec_ctx_t *opt_codec_parameters, /* See asn_codecs.h */
- enum asn_transfer_syntax,
- const struct asn_TYPE_descriptor_s *type_to_encode,
- const void *structure_to_encode,
- asn_app_consume_bytes_f *callback, void *callback_key);
-
-
-/*
- * A callback of this type is called whenever constraint validation fails
- * on some ASN.1 type. See "constraints.h" for more details on constraint
- * validation.
- * This callback specifies a descriptor of the ASN.1 type which failed
- * the constraint check, as well as human readable message on what
- * particular constraint has failed.
- */
-typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
- const struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
- const void *structure_which_failed_ptr,
- const char *error_message_format, ...) CC_PRINTFLIKE(4, 5);
-
-#include "asn1/asn1c/constr_TYPE.h" /* for asn_TYPE_descriptor_t */
-
-#endif /* ASN_APPLICATION_H */
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/asn_codecs_prim.h"
+
#include <assert.h>
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/der_encoder.h"
+
/*
* Decode an always-primitive type.
*/
#ifndef ASN_CODECS_PRIM_H
#define ASN_CODECS_PRIM_H
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
typedef struct ASN__PRIMITIVE_TYPE_s {
uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */
#ifndef __EXTENSIONS__
#define __EXTENSIONS__ /* for Sun */
#endif
-#include "asn1/asn1c/asn_application.h" /* Application-visible API */
+#include "asn1/asn1c/constr_TYPE.h"
/* Environment version might be used to avoid running with the old library */
#define ASN1C_ENVIRONMENT_VERSION 923 /* Compile-time version */
#ifndef ASN_IOC_H
#define ASN_IOC_H
-#include "asn1/asn1c/asn_system.h" /* Platform-specific types */
+#include "asn1/asn1c/asn_system.h"
struct asn_TYPE_descriptor_s;
struct asn_ioc_cell_s;
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
+#include "asn1/asn1c/ber_decoder.h"
#include <assert.h>
#ifndef _BER_DECODER_H_
#define _BER_DECODER_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
struct asn_TYPE_descriptor_s; /* Forward declaration */
struct asn_codec_ctx_s; /* Forward declaration */
size_t size /* Size of that buffer */
);
-/*
- * Type of generic function which decodes the byte stream into the structure.
- */
-typedef asn_dec_rval_t(ber_type_decoder_f)(
- const struct asn_codec_ctx_s *opt_codec_ctx,
- const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,
- const void *buf_ptr, size_t size, int tag_mode);
-
/*******************************
* INTERNALLY USEFUL FUNCTIONS *
*******************************/
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ber_tlv_length.h"
+
+#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ber_tlv_tag.h"
ssize_t
#ifndef _BER_TLV_LENGTH_H_
#define _BER_TLV_LENGTH_H_
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <unistd.h>
+#include "asn1/asn1c/asn_codecs.h"
typedef ssize_t ber_tlv_len_t;
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ber_tlv_tag.h"
+
#include <errno.h>
ssize_t
* Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
+#include "asn1/asn1c/constr_CHOICE.h"
#include <assert.h>
#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/constr_CHOICE.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
/*
* Number of bytes left for this structure.
asn_enc_rval_t
CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+ int flags, asn_app_consume_bytes_f *cb,
void *app_key) {
const asn_CHOICE_specifics_t *specs =
(const asn_CHOICE_specifics_t *)td->specifics;
#ifndef _CONSTR_CHOICE_H_
#define _CONSTR_CHOICE_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
typedef struct asn_CHOICE_specifics_s {
/*
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constr_SEQUENCE.h"
#include <assert.h>
-#include "json_util.h"
+
#include "asn1/asn1c/OPEN_TYPE.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
+#include "json_util.h"
/*
* Number of bytes left for this structure.
asn_enc_rval_t
SEQUENCE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t er;
int xcan = (flags & XER_F_CANONICAL);
#ifndef _CONSTR_SEQUENCE_H_
#define _CONSTR_SEQUENCE_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
typedef struct asn_SEQUENCE_specifics_s {
/*
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constr_SEQUENCE_OF.h"
+
#include "asn1/asn1c/asn_SEQUENCE_OF.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
/*
* The DER encoder of the SEQUENCE OF type.
asn_enc_rval_t
SEQUENCE_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr,
- int ilevel, enum xer_encoder_flags_e flags,
+ int ilevel, int flags,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t er;
const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
#ifndef _CONSTR_SEQUENCE_OF_H_
#define _CONSTR_SEQUENCE_OF_H_
-#include "asn1/asn1c/asn_application.h"
-#include "asn1/asn1c/constr_SET_OF.h" /* Implemented using SET OF */
+#include "asn1/asn1c/constr_SET_OF.h"
+#include "asn1/asn1c/constr_TYPE.h"
/*
* A set specialized functions dealing with the SEQUENCE OF type.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constr_SET_OF.h"
#include <assert.h>
-#include "json_util.h"
+
#include "asn1/asn1c/asn_SET_OF.h"
+#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
+#include "asn1/asn1c/der_encoder.h"
+#include "asn1/asn1c/xer_encoder.h"
+#include "json_util.h"
/*
* Number of bytes left for this structure.
asn_enc_rval_t
SET_OF_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
- enum xer_encoder_flags_e flags, asn_app_consume_bytes_f *cb,
+ int flags, asn_app_consume_bytes_f *cb,
void *app_key) {
asn_enc_rval_t er;
const asn_SET_OF_specifics_t *specs = (const asn_SET_OF_specifics_t *)td->specifics;
#ifndef CONSTR_SET_OF_H
#define CONSTR_SET_OF_H
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
typedef struct asn_SET_OF_specifics_s {
/*
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constr_TYPE.h"
+
#include <errno.h>
#include <stdarg.h>
+#include "asn1/asn1c/asn_internal.h"
+
/*
* Version of the ASN.1 infrastructure shipped with compiler.
*/
#ifndef _CONSTR_TYPE_H_
#define _CONSTR_TYPE_H_
+#include <jansson.h>
+
+#include "asn1/asn1c/asn_system.h"
#include "asn1/asn1c/ber_tlv_length.h"
#include "asn1/asn1c/ber_tlv_tag.h"
ber_tlv_len_t left; /* Number of bytes left, -1 for indefinite */
} asn_struct_ctx_t;
-#include "asn1/asn1c/ber_decoder.h" /* Basic Encoding Rules decoder */
-#include "asn1/asn1c/der_encoder.h" /* Distinguished Encoding Rules encoder */
-#include "asn1/asn1c/xer_encoder.h" /* Encoder into XER (XML, text) */
-#include "asn1/asn1c/json_encoder.h" /* Encoder into JSON */
-#include "asn1/asn1c/constraints.h" /* Subtype constraints support */
-
/*
* Free the structure according to its specification.
* Use one of ASN_STRUCT_{FREE,RESET,CONTENTS_ONLY} macros instead.
#define ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF, ptr) \
(asn_DEF).op->free_struct(&(asn_DEF), (ptr), ASFM_FREE_UNDERLYING)
+/*
+ * Generic type of an application-defined callback to return various
+ * types of data to the application.
+ * EXPECTED RETURN VALUES:
+ * -1: Failed to consume bytes. Abort the mission.
+ * Non-negative return values indicate success, and ignored.
+ */
+typedef int(asn_app_consume_bytes_f)(const void *buffer, size_t size,
+ void *application_specific_key);
+
/*
* Print the structure according to its specification.
*/
const void *struct_A,
const void *struct_B);
+/* Decodes a BER byte stream into a structure. */
+typedef asn_dec_rval_t(ber_type_decoder_f)(
+ const struct asn_codec_ctx_s *opt_codec_ctx,
+ const struct asn_TYPE_descriptor_s *type_descriptor, void **struct_ptr,
+ const void *buf_ptr, size_t size, int tag_mode);
+
+/* Encodes a structure into a DER byte stream. */
+typedef asn_enc_rval_t(der_type_encoder_f)(
+ const struct asn_TYPE_descriptor_s *type_descriptor,
+ const void *struct_ptr, /* Structure to be encoded */
+ int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
+ ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
+ void *app_key /* Arbitrary callback argument */
+);
+
+/* Encodes a structure into a JSON. */
+typedef json_t *(json_type_encoder_f)(
+ const struct asn_TYPE_descriptor_s *type_descriptor,
+ const void *struct_ptr /* Structure to be encoded */
+);
+
+/* Encodes a structure into an XML stream. */
+typedef asn_enc_rval_t(xer_type_encoder_f)(
+ const struct asn_TYPE_descriptor_s *type_descriptor,
+ const void *struct_ptr, /* Structure to be encoded */
+ int ilevel, /* Level of indentation */
+ int xer_flags, /* enum xer_encoder_flags_e */
+ asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
+ void *app_key /* Arbitrary callback argument */
+);
+
/*
* Return the outmost tag of the type.
* If the type is untagged CHOICE, the dynamic operation is performed.
/* The instance of the above function type; used internally. */
asn_outmost_tag_f asn_TYPE_outmost_tag;
+/*
+ * A callback of this type is called whenever constraint validation fails
+ * on some ASN.1 type. See "constraints.h" for more details on constraint
+ * validation.
+ * This callback specifies a descriptor of the ASN.1 type which failed
+ * the constraint check, as well as human readable message on what
+ * particular constraint has failed.
+ */
+typedef void (asn_app_constraint_failed_f)(void *application_specific_key,
+ const struct asn_TYPE_descriptor_s *type_descriptor_which_failed,
+ const void *structure_which_failed_ptr,
+ const char *error_message_format, ...) CC_PRINTFLIKE(4, 5);
+
+/*
+ * Generic type for constraint checking callback,
+ * associated with every type descriptor.
+ */
+typedef int(asn_constr_check_f)(
+ const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr,
+ asn_app_constraint_failed_f *optional_callback, /* Log the error */
+ void *optional_app_key /* Opaque key passed to a callback */
+);
+
/*
* Fetch the desired type of the Open Type based on the
* Information Object Set driven constraints.
-#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constraints.h"
+
#include <stdarg.h>
int
#ifndef ASN1_CONSTRAINTS_VALIDATOR_H
#define ASN1_CONSTRAINTS_VALIDATOR_H
-#include "asn1/asn1c/asn_system.h" /* Platform-dependent types */
+#include "asn1/asn1c/asn_system.h"
+#include "asn1/asn1c/constr_TYPE.h"
struct asn_TYPE_descriptor_s; /* Forward declaration */
size_t *errlen /* Length of the error description */
);
-
-/*
- * Generic type for constraint checking callback,
- * associated with every type descriptor.
- */
-typedef int(asn_constr_check_f)(
- const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct_ptr,
- asn_app_constraint_failed_f *optional_callback, /* Log the error */
- void *optional_app_key /* Opaque key passed to a callback */
-);
-
/*******************************
* INTERNALLY USEFUL FUNCTIONS *
*******************************/
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
-#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/der_encoder.h"
+
#include <assert.h>
+#include "asn1/asn1c/asn_internal.h"
+
static ssize_t der_write_TL(ber_tlv_tag_t tag, ber_tlv_len_t len,
asn_app_consume_bytes_f *cb, void *app_key, int constructed);
#ifndef _DER_ENCODER_H_
#define _DER_ENCODER_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
struct asn_TYPE_descriptor_s; /* Forward declaration */
size_t buffer_size /* Initial buffer size (maximum) */
);
-/*
- * Type of the generic DER encoder.
- */
-typedef asn_enc_rval_t(der_type_encoder_f)(
- const struct asn_TYPE_descriptor_s *type_descriptor,
- const void *struct_ptr, /* Structure to be encoded */
- int tag_mode, /* {-1,0,1}: IMPLICIT, no, EXPLICIT */
- ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
- void *app_key /* Arbitrary callback argument */
-);
-
-
/*******************************
* INTERNALLY USEFUL FUNCTIONS *
*******************************/
#include "asn1/asn1c/json_encoder.h"
#include "asn1/asn1c/asn_internal.h"
+#include "asn1/asn1c/ber_decoder.h"
json_t *
json_encode(const asn_TYPE_descriptor_t *td, const void *sptr)
#define SRC_ASN1_ASN1C_JSON_ENCODER_H_
#include <jansson.h>
+#include <netinet/in.h>
+#include <stddef.h>
#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/types.h>
+#include <unistd.h>
struct asn_TYPE_descriptor_s; /* Forward declaration */
json_t *ber2json(struct asn_TYPE_descriptor_s const *, uint8_t *, size_t);
-/*
- * Type of the generic JSON encoder.
- */
-typedef json_t *(json_type_encoder_f)(
- const struct asn_TYPE_descriptor_s *type_descriptor,
- const void *struct_ptr /* Structure to be encoded */
-);
-
#endif /* SRC_ASN1_ASN1C_JSON_ENCODER_H_ */
* Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
+#include "asn1/asn1c/xer_encoder.h"
+
#include "asn1/asn1c/asn_internal.h"
/*
#ifndef _XER_ENCODER_H_
#define _XER_ENCODER_H_
-#include "asn1/asn1c/asn_application.h"
+#include "asn1/asn1c/constr_TYPE.h"
struct asn_TYPE_descriptor_s; /* Forward declaration */
int xer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td,
const void *struct_ptr);
-/*
- * Type of the generic XER encoder.
- */
-typedef asn_enc_rval_t(xer_type_encoder_f)(
- const struct asn_TYPE_descriptor_s *type_descriptor,
- const void *struct_ptr, /* Structure to be encoded */
- int ilevel, /* Level of indentation */
- enum xer_encoder_flags_e xer_flags,
- asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
- void *app_key /* Arbitrary callback argument */
-);
-
#endif /* _XER_ENCODER_H_ */
#include "asn1/content_info.h"
+#include "asn1/asn1c/ContentType.h"
+#include "asn1/decode.h"
+#include "asn1/oid.h"
#include "file.h"
#include "log.h"
-#include "asn1/oid.h"
-#include "asn1/decode.h"
-#include "asn1/asn1c/ContentType.h"
static int
validate(struct ContentInfo *info)
#include "asn1/decode.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/constraints.h"
#include "common.h"
-#include "log.h"
#include "incidence/incidence.h"
+#include "log.h"
#define COND_LOG(log, pr) (log ? pr : -EINVAL)
#ifndef SRC_ASN1_DECODE_H_
#define SRC_ASN1_DECODE_H_
-#include "file.h"
+#include <stdbool.h>
+
#include "asn1/asn1c/ANY.h"
#include "asn1/asn1c/constr_TYPE.h"
+#include "file.h"
int asn1_decode(const void *, size_t, asn_TYPE_descriptor_t const *, void **,
bool);
#include "asn1/oid.h"
#include "alloc.h"
+#include "asn1/decode.h"
#include "common.h"
#include "log.h"
-#include "asn1/decode.h"
void
free_arcs(struct oid_arcs *arcs)
#ifndef SRC_OID_H_
#define SRC_OID_H_
-#include "common.h"
#include "asn1/asn1c/ANY.h"
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
+#include "common.h"
/* These objects are expected to live on the stack. */
struct oid_arcs {
#include "algorithm.h"
#include "alloc.h"
-#include "config.h"
-#include "log.h"
-#include "asn1/oid.h"
-#include "thread_var.h"
-#include "asn1/decode.h"
#include "asn1/asn1c/ContentType.h"
#include "asn1/asn1c/ContentTypePKCS7.h"
#include "asn1/asn1c/MessageDigest.h"
#include "asn1/asn1c/SignedDataPKCS7.h"
+#include "asn1/decode.h"
+#include "asn1/oid.h"
+#include "config.h"
#include "crypto/hash.h"
+#include "log.h"
#include "object/certificate.h"
+#include "thread_var.h"
static const OID oid_cta = OID_CONTENT_TYPE_ATTR;
static const OID oid_mda = OID_MESSAGE_DIGEST_ATTR;
/* Some wrappers for asn1/asn1c/SignedData.h. */
-#include "resource.h"
#include "asn1/asn1c/SignedData.h"
#include "object/certificate.h"
+#include "resource.h"
struct ee_cert {
/** CRL that might or might not revoke the EE certificate. */
#include "common.h"
#include "config.h"
#include "configure_ac.h"
-#include "file.h"
-#include "json_util.h"
-#include "log.h"
-#include "rrdp.h"
#include "data_structure/array_list.h"
#include "data_structure/path_builder.h"
#include "data_structure/uthash.h"
+#include "file.h"
#include "http/http.h"
+#include "json_util.h"
+#include "log.h"
+#include "rrdp.h"
#include "rsync/rsync.h"
struct cache_node {
#include <sys/queue.h>
#include "alloc.h"
+#include "data_structure/array_list.h"
+#include "object/name.h"
#include "resource.h"
#include "str_token.h"
#include "thread_var.h"
-#include "data_structure/array_list.h"
-#include "object/name.h"
enum defer_node_type {
DNT_SEPARATOR,
#define SRC_CERT_STACK_H_
#include <openssl/bn.h>
-#include "resource.h"
+
#include "object/certificate.h"
#include "object/name.h"
+#include "resource.h"
#include "types/uri.h"
/*
#include "alloc.h"
#include "common.h"
+#include "config/boolean.h"
+#include "config/incidences.h"
+#include "config/str.h"
+#include "config/uint.h"
+#include "config/work_offline.h"
#include "configure_ac.h"
#include "daemon.h"
#include "file.h"
#include "init.h"
#include "json_handler.h"
#include "log.h"
-#include "config/boolean.h"
-#include "config/incidences.h"
-#include "config/str.h"
-#include "config/uint.h"
-#include "config/work_offline.h"
/**
* To add a member to this structure,
#include "config/boolean.h"
#include <getopt.h>
+
#include "log.h"
#define DEREFERENCE(void_value) (*((bool *) void_value))
#include <getopt.h>
-#include "log.h"
#include "config/str.h"
+#include "log.h"
#define VALUE_ROA "roa"
#define VALUE_MFT "mft"
#include <getopt.h>
-#include "log.h"
#include "config/str.h"
+#include "log.h"
#define FNF_VALUE_GLOBAL "global-url"
#define FNF_VALUE_LOCAL "local-path"
#include <stdint.h>
#include <syslog.h>
-#include "log.h"
#include "config/str.h"
+#include "log.h"
#define LOG_LEVEL_VALUE_ERROR "error"
#define LOG_LEVEL_VALUE_WARNING "warning"
#include <getopt.h>
-#include "log.h"
#include "config/str.h"
+#include "log.h"
#define VALUE_SERVER "server"
#define VALUE_STANDALONE "standalone"
#include <getopt.h>
-#include "log.h"
#include "config/str.h"
+#include "log.h"
#define OFM_VALUE_CSV "csv"
#define OFM_VALUE_JSON "json"
#include <getopt.h>
#include "alloc.h"
+#include "config/str.h"
#include "log.h"
#include "str_token.h"
-#include "config/str.h"
void
string_array_init(struct string_array *array, char const *const *values,
#include <errno.h>
#include <getopt.h>
+
#include "log.h"
static void
#include <openssl/buffer.h>
#include <openssl/err.h>
#include <openssl/evp.h>
+
#include "alloc.h"
/*
#include <openssl/evp.h>
#include "alloc.h"
+#include "asn1/oid.h"
#include "common.h"
#include "file.h"
#include "log.h"
-#include "asn1/oid.h"
static int
get_md(char const *algorithm, EVP_MD const **result)
#ifndef SRC_HASH_H_
#define SRC_HASH_H_
-#include "types/uri.h"
#include "asn1/asn1c/BIT_STRING.h"
+#include "types/uri.h"
int hash_validate_mft_file(struct rpki_uri *uri, BIT_STRING_t const *);
int hash_validate_file(struct rpki_uri *, unsigned char const *, size_t);
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+
#include "log.h"
/*
#ifndef SRC_DATA_STRUCTURE_ARRAY_LIST_H_
#define SRC_DATA_STRUCTURE_ARRAY_LIST_H_
-#include "log.h"
#include "data_structure/common.h"
+#include "log.h"
#define DEFINE_ARRAY_LIST_STRUCT(name, elem_type) \
struct name { \
#include "alloc.h"
#include "config.h"
-#include "log.h"
#include "crypto/hash.h"
+#include "log.h"
#define SHA256_LEN (256 >> 3) /* 256 / 8, bits -> bytes */
#ifndef SRC_DATA_STRUCTURE_PATH_BUILDER_H_
#define SRC_DATA_STRUCTURE_PATH_BUILDER_H_
+#include <netdb.h>
+
#include "types/uri.h"
struct path_builder {
#include "extension.h"
#include <openssl/asn1t.h>
+#include <openssl/obj_mac.h>
#include <openssl/objects.h>
-#include <openssl/x509v3.h>
#include "cert_stack.h"
#include "common.h"
+#include "crypto/hash.h"
#include "json_util.h"
#include "libcrypto_util.h"
#include "log.h"
#include "nid.h"
#include "thread_var.h"
-#include "crypto/hash.h"
static json_t *
unimplemented(void const *arg)
#define SRC_EXTENSION_H_
#include <jansson.h>
+#include <openssl/asn1.h>
#include <openssl/safestack.h>
#include <openssl/x509.h>
#include <stdbool.h>
#include <ftw.h>
#include "alloc.h"
-#include "log.h"
#include "data_structure/uthash.h"
+#include "log.h"
int
file_open(char const *file_name, FILE **result, struct stat *stat)
#include <dirent.h>
#include <errno.h>
-#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include "alloc.h"
+#include "cache/local_cache.h"
#include "common.h"
#include "config.h"
+#include "data_structure/uthash.h"
#include "file.h"
#include "log.h"
-#include "data_structure/uthash.h"
-#include "cache/local_cache.h"
struct http_handler {
CURL *curl;
#include "incidence/incidence.h"
#include <assert.h>
+
#include "common.h"
+#include "data_structure/common.h"
#include "json_util.h"
#include "log.h"
-#include "data_structure/common.h"
struct incidence {
const enum incidence_id id;
#include "alloc.h"
#include "config.h"
-#include "log.h"
#include "http/http.h"
+#include "log.h"
static int
fetch_url(char const *url)
#include "alloc.h"
#include "config.h"
-#include "log.h"
#include "config/types.h"
+#include "log.h"
static json_t *
find_json(struct json_t *root, char const *full_name)
#include <errno.h>
#include <limits.h>
#include <time.h>
+
#include "log.h"
/*
#include "libcrypto_util.h"
-#include <stdlib.h>
-#include <openssl/asn1.h>
-#include <openssl/opensslv.h>
+#include <openssl/bio.h>
+#include <openssl/bn.h>
+#include <openssl/buffer.h>
+#include <openssl/objects.h>
#include <openssl/pem.h>
+#include <time.h>
#include "alloc.h"
+#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
#include "extension.h"
#include "json_util.h"
-#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
/* Swallows @bio. */
static json_t *
}
json_t *
-gn2json(GENERAL_NAME const *gn)
+gn2json(GENERAL_NAME *gn)
{
ASN1_IA5STRING *str;
int type;
#include <jansson.h>
#include <openssl/asn1.h>
-#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/safestack.h>
+#include <openssl/x509.h>
#include <openssl/x509v3.h>
json_t *oid2json(ASN1_OBJECT const *);
json_t *asn1str2json(ASN1_STRING const *); /* octet string, bit string, etc */
json_t *asn1time2json(ASN1_TIME const *);
json_t *name2json(X509_NAME const *);
-json_t *gn2json(GENERAL_NAME const *);
+json_t *gn2json(GENERAL_NAME *);
json_t *gns2json(GENERAL_NAMES const *);
json_t *pubkey2json(EVP_PKEY *); /* LibreSSL needs not const */
json_t *exts2json(const STACK_OF(X509_EXTENSION) *);
#include "log.h"
+#include <errno.h>
#ifdef BACKTRACE_ENABLED
#include <execinfo.h>
#endif
-
-#include <errno.h>
#include <openssl/err.h>
#include <pthread.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
+
#include "incidence/incidence.h"
/*
#include "config.h"
#include "extension.h"
-#include "log.h"
-#include "nid.h"
-#include "thread_var.h"
#include "http/http.h"
#include "incidence/incidence.h"
+#include "log.h"
+#include "nid.h"
#include "print_file.h"
-#include "rtr/rtr.h"
#include "rtr/db/vrps.h"
+#include "rtr/rtr.h"
+#include "thread_var.h"
#include "xml/relax_ng.h"
static int
#include "nid.h"
#include <errno.h>
+#include <openssl/obj_mac.h>
#include <openssl/objects.h>
#include "log.h"
#include "alloc.h"
#include "log.h"
-#include "validation_handler.h"
#include "object/certificate.h"
+#include "validation_handler.h"
struct resource_params {
unsigned char const *ski;
#include <openssl/asn1t.h>
#include <openssl/bio.h>
+#if OPENSSL_VERSION_MAJOR >= 3
+#include <openssl/core_names.h>
+#endif
#include <openssl/evp.h>
+#include <openssl/obj_mac.h>
#include <openssl/objects.h>
#include <openssl/rsa.h>
#include <openssl/x509v3.h>
#include <syslog.h>
-#if OPENSSL_VERSION_MAJOR >= 3
-#include <openssl/core_names.h>
-#endif
-
#include "algorithm.h"
#include "alloc.h"
-#include "cert_stack.h"
-#include "config.h"
-#include "extension.h"
-#include "log.h"
-#include "nid.h"
-#include "rrdp.h"
-#include "str_token.h"
-#include "thread_var.h"
+#include "asn1/asn1c/IPAddrBlocks.h"
#include "asn1/decode.h"
#include "asn1/oid.h"
-#include "asn1/asn1c/IPAddrBlocks.h"
+#include "cache/local_cache.h"
+#include "cert_stack.h"
+#include "config.h"
#include "crypto/hash.h"
#include "data_structure/array_list.h"
+#include "extension.h"
#include "incidence/incidence.h"
+#include "log.h"
+#include "nid.h"
#include "object/bgpsec.h"
-#include "object/name.h"
#include "object/manifest.h"
+#include "object/name.h"
#include "object/signed_object.h"
-#include "cache/local_cache.h"
+#include "rrdp.h"
+#include "str_token.h"
+#include "thread_var.h"
/*
* The X509V3_EXT_METHOD that references NID_sinfo_access uses the AIA item.
#ifndef SRC_OBJECT_CERTIFICATE_H_
#define SRC_OBJECT_CERTIFICATE_H_
+#include "asn1/asn1c/ANY.h"
+#include "asn1/asn1c/SignatureValue.h"
#include "certificate_refs.h"
#include "resource.h"
#include "rpp.h"
#include "types/uri.h"
-#include "asn1/asn1c/ANY.h"
-#include "asn1/asn1c/SignatureValue.h"
/* Certificate types in the RPKI */
enum cert_type {
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <syslog.h>
+
#include "algorithm.h"
#include "extension.h"
#include "log.h"
-#include "thread_var.h"
#include "object/name.h"
+#include "thread_var.h"
static int
__crl_load(struct rpki_uri *uri, X509_CRL **result)
#define SRC_OBJECT_CRL_H_
#include <openssl/x509.h>
+
#include "types/uri.h"
int crl_load(struct rpki_uri *uri, X509_CRL **);
#include "object/ghostbusters.h"
-#include "log.h"
-#include "thread_var.h"
#include "asn1/oid.h"
+#include "log.h"
#include "object/signed_object.h"
#include "object/vcard.h"
+#include "thread_var.h"
static int
handle_vcard(struct signed_object *sobj)
#include "object/manifest.h"
#include "algorithm.h"
-#include "common.h"
-#include "log.h"
-#include "thread_var.h"
-#include "asn1/decode.h"
-#include "asn1/oid.h"
#include "asn1/asn1c/GeneralizedTime.h"
#include "asn1/asn1c/Manifest.h"
+#include "asn1/decode.h"
+#include "asn1/oid.h"
+#include "common.h"
#include "crypto/hash.h"
+#include "log.h"
#include "object/certificate.h"
#include "object/crl.h"
#include "object/roa.h"
#include "object/signed_object.h"
+#include "thread_var.h"
static int
cage(struct rpki_uri **uri, struct rpki_uri *notif)
#include "object/name.h"
#include <openssl/asn1.h>
+#include <openssl/obj_mac.h>
#include <openssl/objects.h>
#include <syslog.h>
#include "object/roa.h"
-#include "config.h"
-#include "log.h"
-#include "thread_var.h"
+#include "asn1/asn1c/RouteOriginAttestation.h"
#include "asn1/decode.h"
#include "asn1/oid.h"
-#include "asn1/asn1c/RouteOriginAttestation.h"
+#include "config.h"
+#include "log.h"
#include "object/signed_object.h"
+#include "thread_var.h"
static int
decode_roa(struct signed_object *sobj, struct RouteOriginAttestation **result)
#include "object/signed_object.h"
-#include "log.h"
#include "asn1/content_info.h"
+#include "log.h"
int
signed_object_decode(struct signed_object *sobj, struct rpki_uri *uri)
#include <time.h>
#include "alloc.h"
+#include "cache/local_cache.h"
#include "cert_stack.h"
#include "common.h"
#include "config.h"
+#include "crypto/base64.h"
#include "line_file.h"
#include "log.h"
+#include "object/certificate.h"
+#include "rtr/db/vrps.h"
#include "state.h"
#include "thread_var.h"
#include "validation_handler.h"
-#include "crypto/base64.h"
-#include "object/certificate.h"
-#include "rtr/db/vrps.h"
-#include "cache/local_cache.h"
typedef int (*foreach_uri_cb)(struct tal *, struct rpki_uri *, void *);
/* This is RFC 8630. */
-#include "types/uri.h"
#include "rtr/db/db_table.h"
+#include "types/uri.h"
struct tal;
#include "common.h"
#include "config.h"
+#include "crypto/base64.h"
#include "file.h"
#include "log.h"
-#include "crypto/base64.h"
#include "types/vrp.h"
typedef struct json_out {
#include "print_file.h"
-#include <errno.h>
-#include <stdlib.h>
-
+#include "asn1/asn1c/CRL.h"
+#include "asn1/asn1c/Certificate.h"
+#include "asn1/asn1c/ber_decoder.h"
+#include "asn1/asn1c/json_encoder.h"
+#include "asn1/content_info.h"
#include "common.h"
#include "config.h"
+#include "data_structure/path_builder.h"
#include "file.h"
#include "log.h"
-#include "asn1/content_info.h"
-#include "asn1/asn1c/Certificate.h"
-#include "asn1/asn1c/CRL.h"
-#include "data_structure/path_builder.h"
#include "rsync/rsync.h"
#include "types/bio_seq.h"
#include "types/uri.h"
#include "alloc.h"
#include "cert_stack.h"
#include "log.h"
+#include "resource/ip4.h"
+#include "resource/ip6.h"
#include "sorted_array.h"
#include "thread_var.h"
#include "types/address.h"
-#include "resource/ip4.h"
-#include "resource/ip6.h"
/* The resources we extracted from one certificate. */
struct resources {
#ifndef SRC_RESOURCE_H_
#define SRC_RESOURCE_H_
-#include "resource/asn.h"
-#include "types/address.h"
#include "asn1/asn1c/ASIdentifiers.h"
#include "asn1/asn1c/IPAddressFamily.h"
+#include "resource/asn.h"
+#include "types/address.h"
enum rpki_policy {
/**
#define SRC_RESOURCE_ASN_H_
#include <stdbool.h>
+
#include "as_number.h"
#include "asn1/asn1c/ASId.h"
#include "alloc.h"
#include "cert_stack.h"
-#include "log.h"
-#include "thread_var.h"
-#include "types/uri.h"
#include "data_structure/array_list.h"
+#include "log.h"
#include "object/certificate.h"
#include "object/crl.h"
#include "object/ghostbusters.h"
#include "object/roa.h"
+#include "thread_var.h"
+#include "types/uri.h"
/** A Repository Publication Point (RFC 6481), as described by some manifest. */
struct rpp {
#include <openssl/safestack.h>
#include <openssl/x509.h>
+
#include "types/uri.h"
struct rpp;
#include <ctype.h>
#include <openssl/bn.h>
#include <openssl/evp.h>
+#include <openssl/sha.h>
#include "alloc.h"
+#include "cache/local_cache.h"
#include "common.h"
+#include "crypto/base64.h"
+#include "crypto/hash.h"
#include "file.h"
#include "log.h"
#include "thread_var.h"
-#include "cache/local_cache.h"
-#include "crypto/base64.h"
-#include "crypto/hash.h"
#include "xml/relax_ng.h"
/* RRDP's XML namespace */
#include <errno.h>
#include "alloc.h"
-#include "log.h"
#include "data_structure/uthash.h"
+#include "log.h"
struct hashable_roa {
struct vrp data;
#ifndef SRC_RTR_DB_DB_TABLE_H_
#define SRC_RTR_DB_DB_TABLE_H_
+#include "rtr/db/delta.h"
#include "types/address.h"
#include "types/vrp.h"
-#include "rtr/db/delta.h"
struct db_table;
#include "rtr/db/delta.h"
#include <stdatomic.h>
+
#include "alloc.h"
-#include "types/address.h"
#include "data_structure/array_list.h"
+#include "types/address.h"
struct delta_v4 {
uint32_t as;
#ifndef SRC_RTR_DB_DELTAS_ARRAY_H_
#define SRC_RTR_DB_DELTAS_ARRAY_H_
-#include "types/serial.h"
#include "rtr/db/delta.h"
+#include "types/serial.h"
struct deltas_array;
#include "alloc.h"
#include "common.h"
#include "config.h"
-#include "output_printer.h"
-#include "validation_handler.h"
-#include "types/router_key.h"
#include "data_structure/array_list.h"
#include "object/tal.h"
-#include "rtr/rtr.h"
+#include "output_printer.h"
#include "rtr/db/db_table.h"
+#include "rtr/rtr.h"
#include "slurm/slurm_loader.h"
+#include "types/router_key.h"
+#include "validation_handler.h"
struct vrp_node {
struct delta_vrp delta;
*/
#include "as_number.h"
-#include "types/address.h"
#include "rtr/db/deltas_array.h"
+#include "types/address.h"
int vrps_init(void);
void vrps_destroy(void);
#include "rtr/err_pdu.h"
#include <errno.h>
+
#include "alloc.h"
-#include "rtr/pdu_sender.h"
#include "log.h"
+#include "rtr/pdu_sender.h"
typedef enum rtr_error_code {
ERR_PDU_CORRUPT_DATA = 0,
#ifndef RTR_PDU_H_
#define RTR_PDU_H_
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <unistd.h>
+
#include "common.h"
-#include "types/router_key.h"
#include "rtr/rtr.h"
+#include "types/router_key.h"
enum rtr_version {
RTR_V0 = 0,
#include "rtr/pdu_handler.h"
#include <errno.h>
+
#include "log.h"
#include "rtr/err_pdu.h"
#include "rtr/pdu_sender.h"
#ifndef SRC_RTR_PDU_SENDER_H_
#define SRC_RTR_PDU_SENDER_H_
+#include "rtr/db/vrps.h"
#include "rtr/pdu.h"
#include "types/router_key.h"
-#include "rtr/db/vrps.h"
int send_serial_notify_pdu(int, uint8_t, serial_t);
int send_cache_reset_pdu(int, uint8_t);
#include <errno.h>
-#include "log.h"
#include "alloc.h"
-#include "rtr/pdu.h"
+#include "log.h"
#include "rtr/err_pdu.h"
+#include "rtr/pdu.h"
enum buffer_state {
/* We've read all available bytes for now. */
#ifndef SRC_RTR_PDU_STREAM_H_
#define SRC_RTR_PDU_STREAM_H_
+#include "data_structure/array_list.h"
#include "rtr/pdu.h"
#include "rtr/rtr.h"
-#include "data_structure/array_list.h"
struct pdu_stream; /* It's an *input* stream. */
#include "alloc.h"
#include "config.h"
-#include "types/address.h"
#include "data_structure/array_list.h"
+#include "rtr/db/vrps.h"
#include "rtr/err_pdu.h"
#include "rtr/pdu.h"
#include "rtr/pdu_handler.h"
#include "rtr/pdu_sender.h"
#include "rtr/pdu_stream.h"
-#include "rtr/db/vrps.h"
#include "thread/thread_pool.h"
+#include "types/address.h"
#include "types/serial.h"
struct rtr_server {
#include <openssl/evp.h>
#include <sys/queue.h>
-#include "types/vrp.h"
+
#include "types/router_key.h"
+#include "types/vrp.h"
/* Flags to get data from structs */
#define SLURM_COM_FLAG_NONE 0x00
#include "slurm/slurm_loader.h"
#include <errno.h>
+
#include "alloc.h"
-#include "log.h"
-#include "config.h"
#include "common.h"
+#include "config.h"
#include "crypto/hash.h"
+#include "log.h"
#include "slurm/slurm_parser.h"
#define SLURM_FILE_EXTENSION ".slurm"
#include <errno.h>
#include <openssl/asn1.h>
-#include "crypto/base64.h"
#include "algorithm.h"
#include "alloc.h"
+#include "crypto/base64.h"
#include "json_util.h"
#include "log.h"
+#include "slurm/db_slurm.h"
#include "types/address.h"
#include "types/router_key.h"
-#include "slurm/db_slurm.h"
/* JSON members */
#define SLURM_VERSION "slurmVersion"
#include "state.h"
#include "alloc.h"
+#include "cache/local_cache.h"
#include "cert_stack.h"
#include "log.h"
#include "thread_var.h"
-#include "cache/local_cache.h"
/**
* The current state of the validation cycle.
#ifndef SRC_STATE_H_
#define SRC_STATE_H_
-#include "validation_handler.h"
#include "object/tal.h"
+#include "validation_handler.h"
struct validation;
#include "thread/thread_pool.h"
#include <sys/queue.h>
+
#include "alloc.h"
#include "common.h"
#include "log.h"
#ifndef SRC_TYPES_ADDRESS_H_
#define SRC_TYPES_ADDRESS_H_
+#include <netdb.h>
#include <stdbool.h>
#include <sys/socket.h>
+
#include "asn1/asn1c/IPAddress.h"
#include "asn1/asn1c/IPAddressRange.h"
#include "types/bio_seq.h"
-#include "log.h"
#include "alloc.h"
+#include "log.h"
static BIO_METHOD *method;
#include "alloc.h"
#include "common.h"
#include "config.h"
+#include "config/filename_format.h"
+#include "data_structure/path_builder.h"
#include "log.h"
#include "rrdp.h"
#include "state.h"
#include "str_token.h"
#include "thread_var.h"
-#include "config/filename_format.h"
-#include "data_structure/path_builder.h"
/**
* Design notes:
#define SRC_VALIDATION_HANDLER_H_
#include "as_number.h"
+#include "object/name.h"
#include "types/address.h"
#include "types/router_key.h"
-#include "object/name.h"
/**
* Functions that handle validation results.