]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
ASN.1: Remove random_fills
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Sun, 21 Apr 2024 19:14:02 +0000 (13:14 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Sun, 21 Apr 2024 19:14:02 +0000 (13:14 -0600)
Unused code. Don't know what it's for.

33 files changed:
src/asn1/asn1c/ANY.c
src/asn1/asn1c/BIT_STRING.c
src/asn1/asn1c/BIT_STRING.h
src/asn1/asn1c/BOOLEAN.c
src/asn1/asn1c/BOOLEAN.h
src/asn1/asn1c/GeneralizedTime.c
src/asn1/asn1c/GeneralizedTime.h
src/asn1/asn1c/IA5String.c
src/asn1/asn1c/INTEGER.c
src/asn1/asn1c/INTEGER.h
src/asn1/asn1c/Makefile.include
src/asn1/asn1c/NULL.c
src/asn1/asn1c/NULL.h
src/asn1/asn1c/OBJECT_IDENTIFIER.c
src/asn1/asn1c/OBJECT_IDENTIFIER.h
src/asn1/asn1c/OCTET_STRING.c
src/asn1/asn1c/OCTET_STRING.h
src/asn1/asn1c/OPEN_TYPE.c
src/asn1/asn1c/UTCTime.c
src/asn1/asn1c/UTCTime.h
src/asn1/asn1c/asn_application.c
src/asn1/asn1c/asn_application.h
src/asn1/asn1c/asn_random_fill.c [deleted file]
src/asn1/asn1c/asn_random_fill.h [deleted file]
src/asn1/asn1c/constr_CHOICE.c
src/asn1/asn1c/constr_CHOICE.h
src/asn1/asn1c/constr_SEQUENCE.c
src/asn1/asn1c/constr_SEQUENCE.h
src/asn1/asn1c/constr_SEQUENCE_OF.c
src/asn1/asn1c/constr_SEQUENCE_OF.h
src/asn1/asn1c/constr_SET_OF.c
src/asn1/asn1c/constr_SET_OF.h
src/asn1/asn1c/constr_TYPE.h

index 90a8fc2ca87417dbc4aea690b74d95ca67ebc0c3..f48c97834e351643a64ad5b1e27921669067aff9 100644 (file)
@@ -19,7 +19,6 @@ asn_TYPE_operation_t asn_OP_ANY = {
        OCTET_STRING_decode_ber,
        OCTET_STRING_encode_der,
        ANY_encode_xer,
-       0,      /* Random fill is not defined for ANY type */
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_ANY = {
index cd9636dc6727efca86c62c7ff3a811c255b9fa85..8e311a8765665af56030409744c731989b64bbab 100644 (file)
@@ -27,7 +27,6 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = {
        OCTET_STRING_decode_ber,   /* Implemented in terms of OCTET STRING */
        OCTET_STRING_encode_der,   /* Implemented in terms of OCTET STRING */
        BIT_STRING_encode_xer,
-       BIT_STRING_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_BIT_STRING = {
@@ -287,74 +286,3 @@ BIT_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
         return 1;
     }
 }
-
-asn_random_fill_result_t
-BIT_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                       const asn_encoding_constraints_t *constraints,
-                       size_t max_length) {
-    const asn_OCTET_STRING_specifics_t *specs =
-        td->specifics ? (const asn_OCTET_STRING_specifics_t *)td->specifics
-                      : &asn_SPC_BIT_STRING_specs;
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    static unsigned lengths[] = {0,     1,     2,     3,     4,     8,
-                                 126,   127,   128,   16383, 16384, 16385,
-                                 65534, 65535, 65536, 65537};
-    uint8_t *buf;
-    uint8_t *bend;
-    uint8_t *b;
-    size_t rnd_bits, rnd_len;
-    BIT_STRING_t *st;
-
-    if(max_length == 0) return result_skipped;
-
-    switch(specs->subvariant) {
-    case ASN_OSUBV_ANY:
-        return result_failed;
-    case ASN_OSUBV_BIT:
-        break;
-    default:
-        break;
-    }
-
-    /* Figure out how far we should go */
-    rnd_bits = lengths[asn_random_between(
-        0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
-    if(rnd_bits >= max_length) {
-        rnd_bits = asn_random_between(0, max_length - 1);
-    }
-
-    rnd_len = (rnd_bits + 7) / 8;
-    buf = CALLOC(1, rnd_len + 1);
-    if(!buf) return result_failed;
-
-    bend = &buf[rnd_len];
-
-    for(b = buf; b < bend; b++) {
-        *(uint8_t *)b = asn_random_between(0, 255);
-    }
-    *b = 0; /* Zero-terminate just in case. */
-
-    if(*sptr) {
-        st = *sptr;
-        FREEMEM(st->buf);
-    } else {
-        st = (BIT_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
-        if(!st) {
-            FREEMEM(buf);
-            return result_failed;
-        }
-    }
-
-    st->buf = buf;
-    st->size = rnd_len;
-    st->bits_unused = (8 - (rnd_bits & 0x7)) & 0x7;
-    if(st->bits_unused) {
-        assert(st->size > 0);
-        st->buf[st->size-1] &= 0xff << st->bits_unused;
-    }
-
-    result_ok.length = st->size;
-    return result_ok;
-}
index acac92a82be3fbd43f6c49610362f9c893674614..0176dde7bcb1ca8f9a359b7254dc6b7b27b6cc59 100644 (file)
@@ -24,7 +24,6 @@ asn_struct_print_f BIT_STRING_print;  /* Human-readable output */
 asn_struct_compare_f BIT_STRING_compare;
 asn_constr_check_f BIT_STRING_constraint;
 xer_type_encoder_f BIT_STRING_encode_xer;
-asn_random_fill_f  BIT_STRING_random_fill;
 
 #define BIT_STRING_free              OCTET_STRING_free
 #define BIT_STRING_decode_ber        OCTET_STRING_decode_ber
index f4e80182c5f4754659b14b2f80573854c288827f..b0fdef44bdd0526b6d606cf5751ce1bdb25f59ec 100644 (file)
@@ -19,7 +19,6 @@ asn_TYPE_operation_t asn_OP_BOOLEAN = {
        BOOLEAN_decode_ber,
        BOOLEAN_encode_der,
        BOOLEAN_encode_xer,
-       BOOLEAN_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
@@ -220,38 +219,3 @@ BOOLEAN_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
         return 1;
     }
 }
-
-asn_random_fill_result_t
-BOOLEAN_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                    const asn_encoding_constraints_t *constraints,
-                    size_t max_length) {
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    BOOLEAN_t *st = *sptr;
-
-    if(max_length == 0) return result_skipped;
-
-    if(st == NULL) {
-        st = (BOOLEAN_t *)(*sptr = CALLOC(1, sizeof(*st)));
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    /* Simulate booleans that are sloppily set and biased. */
-    switch(asn_random_between(0, 7)) {
-    case 0:
-    case 1:
-    case 2:
-        *st = 0; break;
-    case 3: *st = -1; break;
-    case 4: *st = 1; break;
-    case 5: *st = INT_MIN; break;
-    case 6: *st = INT_MAX; break;
-    default:
-        *st = asn_random_between(INT_MIN, INT_MAX);
-        break;
-    }
-    return result_ok;
-}
index bb9e8a8535f7de9f7c0484c60bd65fec2e655313..0f5f85321904d6d2d2b380533c40bd2b59635bf7 100644 (file)
@@ -23,7 +23,6 @@ asn_struct_compare_f BOOLEAN_compare;
 ber_type_decoder_f BOOLEAN_decode_ber;
 der_type_encoder_f BOOLEAN_encode_der;
 xer_type_encoder_f BOOLEAN_encode_xer;
-asn_random_fill_f  BOOLEAN_random_fill;
 
 #define BOOLEAN_constraint     asn_generic_no_constraint
 
index 6b5ad9e38623e6b508b514c184a39d8c38dd37f8..f8efc307497a5216a6d6ff766af2926de0b5adff 100644 (file)
@@ -59,7 +59,6 @@ asn_TYPE_operation_t asn_OP_GeneralizedTime = {
        OCTET_STRING_decode_ber,    /* Implemented in terms of OCTET STRING */
        GeneralizedTime_encode_der,
        GeneralizedTime_encode_xer,
-       GeneralizedTime_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_GeneralizedTime = {
@@ -476,38 +475,6 @@ asn_time2GT_frac(GeneralizedTime_t *opt_gt, const struct tm *tm, int frac_value,
        return opt_gt;
 }
 
-asn_random_fill_result_t
-GeneralizedTime_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                              const asn_encoding_constraints_t *constraints,
-                              size_t max_length) {
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    static const char *values[] = {
-        "19700101000000",    "19700101000000-0000",   "19700101000000+0000",
-        "19700101000000Z",   "19700101000000.3Z",     "19821106210623.3",
-        "19821106210629.3Z", "19691106210827.3-0500", "19821106210629.456",
-    };
-    size_t rnd = asn_random_between(0, sizeof(values)/sizeof(values[0])-1);
-
-    (void)constraints;
-
-    if(max_length < sizeof("yyyymmddhhmmss") && !*sptr) {
-        return result_skipped;
-    }
-
-    if(*sptr) {
-        if(OCTET_STRING_fromBuf(*sptr, values[rnd], -1) != 0) {
-            if(!sptr) return result_failed;
-        }
-    } else {
-        *sptr = OCTET_STRING_new_fromBuf(td, values[rnd], -1);
-        if(!sptr) return result_failed;
-    }
-
-    return result_ok;
-}
-
 int
 GeneralizedTime_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
                         const void *bptr) {
index 7a8ad1bbd9e9cfe7db5e000d245adbc9da1c13fb..5a974f4ba736f6043744e336076266f07b3e57fe 100644 (file)
@@ -19,7 +19,6 @@ asn_struct_compare_f GeneralizedTime_compare;
 asn_constr_check_f GeneralizedTime_constraint;
 der_type_encoder_f GeneralizedTime_encode_der;
 xer_type_encoder_f GeneralizedTime_encode_xer;
-asn_random_fill_f  GeneralizedTime_random_fill;
 
 #define GeneralizedTime_free           OCTET_STRING_free
 #define GeneralizedTime_decode_ber     OCTET_STRING_decode_ber
index a99387d60350119839c2613f28f07b76ec75aa59..29a9df29cf8022a4a41a0655b8953baf31384469 100644 (file)
@@ -19,7 +19,6 @@ asn_TYPE_operation_t asn_OP_IA5String = {
        OCTET_STRING_decode_ber,    /* Implemented in terms of OCTET STRING */
        OCTET_STRING_encode_der,
        OCTET_STRING_encode_xer_utf8,
-       OCTET_STRING_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_IA5String = {
index fac951db6d7d230b5f0249dd7a199f1cae1d5358..2d6d0dfaa62de2c515287ad06ed0a8468712f74c 100644 (file)
@@ -22,7 +22,6 @@ asn_TYPE_operation_t asn_OP_INTEGER = {
        ber_decode_primitive,
        INTEGER_encode_der,
        INTEGER_encode_xer,
-       INTEGER_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_INTEGER = {
@@ -711,75 +710,3 @@ INTEGER_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
     }
 
 }
-
-asn_random_fill_result_t
-INTEGER_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                    const asn_encoding_constraints_t *constraints,
-                    size_t max_length) {
-    const asn_INTEGER_specifics_t *specs =
-        (const asn_INTEGER_specifics_t *)td->specifics;
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    INTEGER_t *st = *sptr;
-    const asn_INTEGER_enum_map_t *emap;
-    size_t emap_len;
-    intmax_t value;
-    int find_inside_map;
-
-    if(max_length == 0) return result_skipped;
-
-    if(st == NULL) {
-        st = (INTEGER_t *)CALLOC(1, sizeof(*st));
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    if(specs) {
-        emap = specs->value2enum;
-        emap_len = specs->map_count;
-        if(specs->strict_enumeration) {
-            find_inside_map = emap_len > 0;
-        } else {
-            find_inside_map = emap_len ? asn_random_between(0, 1) : 0;
-        }
-    } else {
-        emap = 0;
-        emap_len = 0;
-        find_inside_map = 0;
-    }
-
-    if(find_inside_map) {
-        assert(emap_len > 0);
-        value = emap[asn_random_between(0, emap_len - 1)].nat_value;
-    } else {
-        static const long variants[] = {
-            -65536, -65535, -65534, -32769, -32768, -32767, -16385, -16384,
-            -16383, -257,   -256,   -255,   -254,   -129,   -128,   -127,
-            -126,   -1,     0,      1,      126,    127,    128,    129,
-            254,    255,    256,    257,    16383,  16384,  16385,  32767,
-            32768,  32769,  65534,  65535,  65536,  65537};
-        if(specs && specs->field_unsigned) {
-            assert(variants[18] == 0);
-            value = variants[asn_random_between(
-                18, sizeof(variants) / sizeof(variants[0]) - 1)];
-        } else {
-            value = variants[asn_random_between(
-                0, sizeof(variants) / sizeof(variants[0]) - 1)];
-        }
-    }
-
-    if(asn_imax2INTEGER(st, value)) {
-        if(st == *sptr) {
-            ASN_STRUCT_RESET(*td, st);
-        } else {
-            ASN_STRUCT_FREE(*td, st);
-        }
-        return result_failed;
-    } else {
-        *sptr = st;
-        result_ok.length = st->size;
-        return result_ok;
-    }
-}
index 9367d05f6a176d4fffd7917e990e401a77f8248b..acc07ce3491404f45d94b971211279356c42fd2c 100644 (file)
@@ -38,7 +38,6 @@ asn_struct_print_f INTEGER_print;
 asn_struct_compare_f INTEGER_compare;
 der_type_encoder_f INTEGER_encode_der;
 xer_type_encoder_f INTEGER_encode_xer;
-asn_random_fill_f  INTEGER_random_fill;
 
 /***********************************
  * Some handy conversion routines. *
index 01e1d9f89d14caaa428c12c6ff99b95deffcd98a..5043095d5e19d538905a4b67bea223c3c0757a2a 100644 (file)
@@ -162,8 +162,6 @@ ASN_MODULE_HDRS+=asn1/asn1c/asn_system.h
 ASN_MODULE_HDRS+=asn1/asn1c/asn_codecs.h
 ASN_MODULE_HDRS+=asn1/asn1c/asn_internal.h
 ASN_MODULE_SRCS+=asn1/asn1c/asn_internal.c
-ASN_MODULE_HDRS+=asn1/asn1c/asn_random_fill.h
-ASN_MODULE_SRCS+=asn1/asn1c/asn_random_fill.c
 ASN_MODULE_SRCS+=asn1/asn1c/OCTET_STRING.c
 ASN_MODULE_HDRS+=asn1/asn1c/BIT_STRING.h
 ASN_MODULE_SRCS+=asn1/asn1c/BIT_STRING.c
index 70f1e249145802eca530aebbafd7068728d13a05..2811a8462bb3d637f9fe796eabdc4d56ca19dd25 100644 (file)
@@ -19,7 +19,6 @@ asn_TYPE_operation_t asn_OP_NULL = {
        NULL_decode_ber,
        NULL_encode_der,        /* Special handling of DER encoding */
        NULL_encode_xer,
-       NULL_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_NULL = {
@@ -146,27 +145,3 @@ NULL_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
                return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
        }
 }
-
-asn_random_fill_result_t
-NULL_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                    const asn_encoding_constraints_t *constr,
-                    size_t max_length) {
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    NULL_t *st = *sptr;
-
-    (void)td;
-    (void)constr;
-
-    if(max_length == 0) return result_skipped;
-
-    if(st == NULL) {
-        st = (NULL_t *)(*sptr = CALLOC(1, sizeof(*st)));
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    return result_ok;
-}
index f6b877aae3aeba83faa10c044ed2953e98f32a0f..f93bd4aef00203746914e1084dca07eed1cf572a 100644 (file)
@@ -22,7 +22,6 @@ asn_struct_compare_f NULL_compare;
 ber_type_decoder_f NULL_decode_ber;
 der_type_encoder_f NULL_encode_der;
 xer_type_encoder_f NULL_encode_xer;
-asn_random_fill_f  NULL_random_fill;
 
 #define NULL_constraint        asn_generic_no_constraint
 
index 00a9d86757a4e4e1a4f0187f7f097c24afc9a200..c964c8090273f8932ec665484d4b122e960c202f 100644 (file)
@@ -23,7 +23,6 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = {
        ber_decode_primitive,
        der_encode_primitive,
        OBJECT_IDENTIFIER_encode_xer,
-       OBJECT_IDENTIFIER_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_OBJECT_IDENTIFIER = {
@@ -509,69 +508,3 @@ OBJECT_IDENTIFIER_parse_arcs(const char *oid_text, ssize_t oid_txt_length,
        errno = EINVAL; /* Broken OID */
        return -1;
 }
-
-/*
- * Generate values from the list of interesting values, or just a random
- * value up to the upper limit.
- */
-static asn_oid_arc_t
-OBJECT_IDENTIFIER__biased_random_arc(asn_oid_arc_t upper_bound) {
-    const asn_oid_arc_t values[] = {0, 1, 127, 128, 129, 254, 255, 256};
-    size_t idx;
-
-    switch(asn_random_between(0, 2)) {
-    case 0:
-        idx = asn_random_between(0, sizeof(values) / sizeof(values[0]) - 1);
-        if(values[idx] < upper_bound) {
-            return values[idx];
-        }
-        /* Fall through */
-    case 1:
-        return asn_random_between(0, upper_bound);
-    case 2:
-    default:
-        return upper_bound;
-    }
-}
-
-asn_random_fill_result_t
-OBJECT_IDENTIFIER_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                              const asn_encoding_constraints_t *constraints,
-                              size_t max_length) {
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    OBJECT_IDENTIFIER_t *st;
-    asn_oid_arc_t arcs[5];
-    size_t arcs_len = asn_random_between(2, 5);
-    size_t i;
-
-    (void)constraints;
-
-    if(max_length < arcs_len) return result_skipped;
-
-    if(*sptr) {
-        st = *sptr;
-    } else {
-        st = CALLOC(1, sizeof(*st));
-    }
-
-    arcs[0] = asn_random_between(0, 2);
-    arcs[1] = OBJECT_IDENTIFIER__biased_random_arc(
-        arcs[0] <= 1 ? 39 : (ASN_OID_ARC_MAX - 80));
-    for(i = 2; i < arcs_len; i++) {
-        arcs[i] = OBJECT_IDENTIFIER__biased_random_arc(ASN_OID_ARC_MAX);
-    }
-
-    if(OBJECT_IDENTIFIER_set_arcs(st, arcs, arcs_len)) {
-        if(st != *sptr) {
-            ASN_STRUCT_FREE(*td, st);
-        }
-        return result_failed;
-    }
-
-    *sptr = st;
-
-    result_ok.length = st->size;
-    return result_ok;
-}
index c210cb5b324cd3cf461e40a77b56bd1df48ecdbf..78fcecd86c867272cbdfc935ddd1b71e2b65ce1e 100644 (file)
@@ -21,7 +21,6 @@ asn_struct_print_f OBJECT_IDENTIFIER_print;
 asn_constr_check_f OBJECT_IDENTIFIER_constraint;
 der_type_encoder_f OBJECT_IDENTIFIER_encode_der;
 xer_type_encoder_f OBJECT_IDENTIFIER_encode_xer;
-asn_random_fill_f  OBJECT_IDENTIFIER_random_fill;
 
 #define OBJECT_IDENTIFIER_free           ASN__PRIMITIVE_TYPE_free
 #define OBJECT_IDENTIFIER_compare        OCTET_STRING_compare
index ecd17f83ed60ac4a24f949c0220876899700177a..377c8fcd8de3b24a18ae73e7bf51b043c82a5070 100644 (file)
@@ -28,7 +28,6 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = {
        OCTET_STRING_decode_ber,
        OCTET_STRING_encode_der,
        OCTET_STRING_encode_xer,
-       OCTET_STRING_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
@@ -940,147 +939,3 @@ OCTET_STRING_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
     }
 
 }
-
-/*
- * Biased function for randomizing character values around their limits.
- */
-static uint32_t
-OCTET_STRING__random_char(unsigned long lb, unsigned long ub) {
-    assert(lb <= ub);
-    switch(asn_random_between(0, 16)) {
-    case 0:
-        if(lb < ub) return lb + 1;
-        /* Fall through */
-    case 1:
-        return lb;
-    case 2:
-        if(lb < ub) return ub - 1;
-        /* Fall through */
-    case 3:
-        return ub;
-    default:
-        return asn_random_between(lb, ub);
-    }
-}
-
-
-size_t
-OCTET_STRING_random_length_constrained(
-    const asn_TYPE_descriptor_t *td,
-    const asn_encoding_constraints_t *constraints, size_t max_length) {
-    const unsigned lengths[] = {0,     1,     2,     3,     4,     8,
-                                126,   127,   128,   16383, 16384, 16385,
-                                65534, 65535, 65536, 65537};
-    size_t rnd_len;
-
-    /* Figure out how far we should go */
-    rnd_len = lengths[asn_random_between(
-        0, sizeof(lengths) / sizeof(lengths[0]) - 1)];
-
-    if(rnd_len > max_length) {
-        rnd_len = asn_random_between(0, max_length);
-    }
-
-    return rnd_len;
-}
-
-asn_random_fill_result_t
-OCTET_STRING_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                         const asn_encoding_constraints_t *constraints,
-                         size_t max_length) {
-       const asn_OCTET_STRING_specifics_t *specs = td->specifics
-                               ? (const asn_OCTET_STRING_specifics_t *)td->specifics
-                               : &asn_SPC_OCTET_STRING_specs;
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    unsigned int unit_bytes = 1;
-    unsigned long clb = 0;  /* Lower bound on char */
-    unsigned long cub = 255;  /* Higher bound on char value */
-    uint8_t *buf;
-    uint8_t *bend;
-    uint8_t *b;
-    size_t rnd_len;
-    OCTET_STRING_t *st;
-
-    if(max_length == 0 && !*sptr) return result_skipped;
-
-    switch(specs->subvariant) {
-    default:
-    case ASN_OSUBV_ANY:
-        return result_failed;
-    case ASN_OSUBV_BIT:
-        /* Handled by BIT_STRING itself. */
-        return result_failed;
-    case ASN_OSUBV_STR:
-        unit_bytes = 1;
-        clb = 0;
-        cub = 255;
-        break;
-    case ASN_OSUBV_U16:
-        unit_bytes = 2;
-        clb = 0;
-        cub = 65535;
-        break;
-    case ASN_OSUBV_U32:
-        unit_bytes = 4;
-        clb = 0;
-        cub = 0x10FFFF;
-        break;
-    }
-
-    if(!constraints)
-        constraints = &td->encoding_constraints;
-
-    rnd_len =
-        OCTET_STRING_random_length_constrained(td, constraints, max_length);
-
-    buf = CALLOC(unit_bytes, rnd_len + 1);
-    if(!buf) return result_failed;
-
-    bend = &buf[unit_bytes * rnd_len];
-
-    switch(unit_bytes) {
-    case 1:
-        for(b = buf; b < bend; b += unit_bytes) {
-            *(uint8_t *)b = OCTET_STRING__random_char(clb, cub);
-        }
-        *(uint8_t *)b = 0;
-        break;
-    case 2:
-        for(b = buf; b < bend; b += unit_bytes) {
-            uint32_t code = OCTET_STRING__random_char(clb, cub);
-            b[0] = code >> 8;
-            b[1] = code;
-        }
-        *(uint16_t *)b = 0;
-        break;
-    case 4:
-        for(b = buf; b < bend; b += unit_bytes) {
-            uint32_t code = OCTET_STRING__random_char(clb, cub);
-            b[0] = code >> 24;
-            b[1] = code >> 16;
-            b[2] = code >> 8;
-            b[3] = code;
-        }
-        *(uint32_t *)b = 0;
-        break;
-    }
-
-    if(*sptr) {
-        st = *sptr;
-        FREEMEM(st->buf);
-    } else {
-        st = (OCTET_STRING_t *)(*sptr = CALLOC(1, specs->struct_size));
-        if(!st) {
-            FREEMEM(buf);
-            return result_failed;
-        }
-    }
-
-    st->buf = buf;
-    st->size = unit_bytes * rnd_len;
-
-    result_ok.length = st->size;
-    return result_ok;
-}
index d12b5a61d2a52951290f3014c3f7c767cb7781d8..c05687508d98d10509b45299589bed30f73607a2 100644 (file)
@@ -33,7 +33,6 @@ ber_type_decoder_f OCTET_STRING_decode_ber;
 der_type_encoder_f OCTET_STRING_encode_der;
 xer_type_encoder_f OCTET_STRING_encode_xer;
 xer_type_encoder_f OCTET_STRING_encode_xer_utf8;
-asn_random_fill_f  OCTET_STRING_random_fill;
 
 #define OCTET_STRING_constraint  asn_generic_no_constraint
 
@@ -85,8 +84,4 @@ typedef struct asn_OCTET_STRING_specifics_s {
 
 extern asn_OCTET_STRING_specifics_t asn_SPC_OCTET_STRING_specs;
 
-size_t OCTET_STRING_random_length_constrained(
-    const asn_TYPE_descriptor_t *, const asn_encoding_constraints_t *,
-    size_t max_length);
-
 #endif /* _OCTET_STRING_H_ */
index b7c51929e9923c79856d04ffb357148b0f94c8ec..fb167a928a929f4bf51035b5f0eb485713f3be8b 100644 (file)
@@ -14,7 +14,6 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
        OPEN_TYPE_decode_ber,
        OPEN_TYPE_encode_der,
        OPEN_TYPE_encode_xer,
-       0,  /* Random fill is not supported for open type */
        0,      /* Use generic outmost tag fetcher */
 };
 
index b96b27e005f83d3d4871736a4c3addd37e752995..4e45451bf655af94d92b72422b26d21daedd9de9 100644 (file)
@@ -27,7 +27,6 @@ asn_TYPE_operation_t asn_OP_UTCTime = {
        OCTET_STRING_decode_ber,    /* Implemented in terms of OCTET STRING */
        OCTET_STRING_encode_der,    /* Implemented in terms of OCTET STRING */
        UTCTime_encode_xer,
-       UTCTime_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
 asn_TYPE_descriptor_t asn_DEF_UTCTime = {
@@ -166,39 +165,6 @@ asn_time2UT(UTCTime_t *opt_ut, const struct tm *tm) {
        return (UTCTime_t *)gt;
 }
 
-
-asn_random_fill_result_t
-UTCTime_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                    const asn_encoding_constraints_t *constraints,
-                    size_t max_length) {
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 1};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    static const char *values[] = {
-        "700101000000",  "700101000000-0000", "700101000000+0000",
-        "700101000000Z", "821106210623",      "691106210827-0500",
-        "821106210629Z",
-    };
-    size_t rnd = asn_random_between(0, sizeof(values)/sizeof(values[0])-1);
-
-    (void)constraints;
-
-    if(max_length < sizeof("yymmddhhmmss") && !*sptr) {
-        return result_skipped;
-    }
-
-    if(*sptr) {
-        if(OCTET_STRING_fromBuf(*sptr, values[rnd], -1) != 0) {
-            if(!sptr) return result_failed;
-        }
-    } else {
-        *sptr = OCTET_STRING_new_fromBuf(td, values[rnd], -1);
-        if(!sptr) return result_failed;
-    }
-
-    return result_ok;
-}
-
 int
 UTCTime_compare(const asn_TYPE_descriptor_t *td, const void *aptr,
                         const void *bptr) {
index 2b035282b68e112ea6aa1c65ad557348f7428122..25f308e78380b5e24ef4f9eb3fa92cefecac2e8d 100644 (file)
@@ -18,7 +18,6 @@ asn_struct_print_f UTCTime_print;
 asn_struct_compare_f UTCTime_compare;
 asn_constr_check_f UTCTime_constraint;
 xer_type_encoder_f UTCTime_encode_xer;
-asn_random_fill_f  UTCTime_random_fill;
 
 #define UTCTime_free         OCTET_STRING_free
 #define UTCTime_decode_ber   OCTET_STRING_decode_ber
index d2ca1c18ad1805e48397a79d55fbd00713a778f3..1106160f67029788d868c44e5077b4b5e9c23f7f 100644 (file)
@@ -261,10 +261,6 @@ asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
         }
         break;
 
-    case ATS_RANDOM:
-        errno = ENOENT; /* Randomization doesn't make sense on output. */
-        ASN__ENCODE_FAILED;
-
     case ATS_BER:
         /* BER is a superset of DER. */
         /* Fall through. */
@@ -310,19 +306,6 @@ asn_decode(const asn_codec_ctx_t *opt_codec_ctx,
         errno = ENOENT;
         ASN__DECODE_FAILED;
 
-    case ATS_RANDOM:
-        if(!td->op->random_fill) {
-            ASN__DECODE_FAILED;
-        } else {
-            if(asn_random_fill(td, sptr, 16000) == 0) {
-                asn_dec_rval_t ret = {RC_OK, 0};
-                return ret;
-            } else {
-                ASN__DECODE_FAILED;
-            }
-        }
-        break;
-
     case ATS_DER:
     case ATS_BER:
         return ber_decode(opt_codec_ctx, td, sptr, buffer, size);
index 94c3407a536d55f5e3bcbdb7574bcca37a807573..8382ca80375c3e78b9b314cd28d9d4d89714b70f 100644 (file)
@@ -20,8 +20,6 @@ enum asn_transfer_syntax {
     ATS_INVALID = 0,
     /* Plaintext output (not conforming to any standard), for debugging. */
     ATS_NONSTANDARD_PLAINTEXT,
-    /* Returns a randomly generatede structure. */
-    ATS_RANDOM,
     /*
      * X.690:
      * BER: Basic Encoding Rules.
diff --git a/src/asn1/asn1c/asn_random_fill.c b/src/asn1/asn1c/asn_random_fill.c
deleted file mode 100644 (file)
index 3323641..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
- * All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-
-#include <assert.h>
-
-#include "asn1/asn1c/asn_internal.h"
-#include "asn1/asn1c/asn_random_fill.h"
-#include "asn1/asn1c/constr_TYPE.h"
-
-int
-asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr,
-                size_t length) {
-
-    if(td && td->op->random_fill) {
-        asn_random_fill_result_t res =
-            td->op->random_fill(td, struct_ptr, 0, length);
-        return (res.code == ARFILL_OK) ? 0 : -1;
-    } else {
-        return -1;
-    }
-}
-
-static uintmax_t
-asn__intmax_range(intmax_t lb, intmax_t ub) {
-    assert(lb <= ub);
-    if((ub < 0) == (lb < 0)) {
-        return ub - lb;
-    } else if(lb < 0) {
-        return 1 + ((uintmax_t)ub + (uintmax_t)-(lb + 1));
-    } else {
-        assert(!"Unreachable");
-        return 0;
-    }
-}
-
-intmax_t
-asn_random_between(intmax_t lb, intmax_t rb) {
-    if(lb == rb) {
-        return lb;
-    } else {
-        const uintmax_t intmax_max = ((~(uintmax_t)0) >> 1);
-        uintmax_t range = asn__intmax_range(lb, rb);
-        uintmax_t value = 0;
-        uintmax_t got_entropy = 0;
-
-        assert(RAND_MAX > 0xffffff);    /* Seen 7ffffffd! */
-        assert(range < intmax_max);
-
-        for(; got_entropy < range;) {
-            got_entropy = (got_entropy << 24) | 0xffffff;
-            value = (value << 24) | (random() % 0xffffff);
-        }
-
-        return lb + (intmax_t)(value % (range + 1));
-    }
-}
diff --git a/src/asn1/asn1c/asn_random_fill.h b/src/asn1/asn1c/asn_random_fill.h
deleted file mode 100644 (file)
index e5383b2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
- * Redistribution and modifications are permitted subject to BSD license.
- */
-#ifndef        ASN_RANDOM_FILL
-#define        ASN_RANDOM_FILL
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-/* Forward declarations */
-struct asn_TYPE_descriptor_s;
-struct asn_encoding_constraints_s;
-
-/*
- * Initialize a structure with random data according to the type specification
- * and optional member constraints.
- * ARGUMENTS:
- *  (max_length)        - See (approx_max_length_limit).
- *  (memb_constraints)  - Member constraints, if exist.
- * In case the return differs from ARFILL_OK, the (struct_ptr) contents
- * and (current_length) value remain in their original state.
- */
-typedef struct asn_random_fill_result_s {
-    enum {
-        ARFILL_FAILED = -1, /* System error (memory?) */
-        ARFILL_OK = 0,      /* Initialization succeeded */
-        ARFILL_SKIPPED = 1  /* Not done due to (length?) constraint */
-    } code;
-    size_t length; /* Approximate number of bytes created. */
-} asn_random_fill_result_t;
-typedef asn_random_fill_result_t(asn_random_fill_f)(
-    const struct asn_TYPE_descriptor_s *td, void **struct_ptr,
-    const struct asn_encoding_constraints_s *memb_constraints,
-    size_t max_length);
-
-/*
- * Returns 0 if the structure was properly initialized, -1 otherwise.
- * The (approx_max_length_limit) specifies the approximate limit of the
- * resulting structure in units closely resembling bytes. The actual result
- * might be several times larger or smaller than the length limit.
- */
-int asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr,
-                    size_t approx_max_length_limit);
-
-/*
- * Returns a random number between min and max.
- */
-intmax_t asn_random_between(intmax_t min, intmax_t max);
-
-#endif /* ASN_RANDOM_FILL */
index 2f017b78b9ac1d5cdb0edfbfacbcd550e76c940b..05039e2ed1ded8ca3534393256a95ef453e78fd2 100644 (file)
@@ -837,61 +837,6 @@ CHOICE_variant_set_presence(const asn_TYPE_descriptor_t *td, void *sptr,
     return 0;
 }
 
-
-asn_random_fill_result_t
-CHOICE_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                   const asn_encoding_constraints_t *constr,
-                   size_t max_length) {
-    const asn_CHOICE_specifics_t *specs =
-        (const asn_CHOICE_specifics_t *)td->specifics;
-    asn_random_fill_result_t res;
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    const asn_TYPE_member_t *elm;
-    unsigned present;
-    void *memb_ptr;   /* Pointer to the member */
-    void **memb_ptr2; /* Pointer to that pointer */
-    void *st = *sptr;
-
-    if(max_length == 0) return result_skipped;
-
-    (void)constr;
-
-    if(st == NULL) {
-        st = CALLOC(1, specs->struct_size);
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    present = asn_random_between(1, td->elements_count);
-    elm = &td->elements[present - 1];
-
-       if(elm->flags & ATF_POINTER) {
-               /* Member is a pointer to another structure */
-               memb_ptr2 = (void **)((char *)st + elm->memb_offset);
-       } else {
-               memb_ptr = (char *)st + elm->memb_offset;
-               memb_ptr2 = &memb_ptr;
-       }
-
-    res = elm->type->op->random_fill(elm->type, memb_ptr2,
-                                    &elm->encoding_constraints, max_length);
-    _set_present_idx(st, specs->pres_offset, specs->pres_size, present);
-    if(res.code == ARFILL_OK) {
-        *sptr = st;
-    } else {
-        if(st == *sptr) {
-            ASN_STRUCT_RESET(*td, st);
-        } else {
-            ASN_STRUCT_FREE(*td, st);
-        }
-    }
-
-    return res;
-}
-
-
 asn_TYPE_operation_t asn_OP_CHOICE = {
        CHOICE_free,
        CHOICE_print,
@@ -899,6 +844,5 @@ asn_TYPE_operation_t asn_OP_CHOICE = {
        CHOICE_decode_ber,
        CHOICE_encode_der,
        CHOICE_encode_xer,
-       CHOICE_random_fill,
        CHOICE_outmost_tag
 };
index a9490d938aa2c6a4252ae49a4fcf420a48834765..f8101e8ad826eb62ead023231633323702fcf88c 100644 (file)
@@ -39,7 +39,6 @@ ber_type_decoder_f CHOICE_decode_ber;
 der_type_encoder_f CHOICE_encode_der;
 xer_type_encoder_f CHOICE_encode_xer;
 asn_outmost_tag_f CHOICE_outmost_tag;
-asn_random_fill_f CHOICE_random_fill;
 extern asn_TYPE_operation_t asn_OP_CHOICE;
 
 /*
index ccc4c8c193ff8f00fd21296ea4585e8ffc14863d..ce2ea37eb184279b80a125c89ee08b734581dd90 100644 (file)
@@ -868,74 +868,5 @@ asn_TYPE_operation_t asn_OP_SEQUENCE = {
        SEQUENCE_decode_ber,
        SEQUENCE_encode_der,
        SEQUENCE_encode_xer,
-       SEQUENCE_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
-
-
-asn_random_fill_result_t
-SEQUENCE_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                   const asn_encoding_constraints_t *constr,
-                   size_t max_length) {
-    const asn_SEQUENCE_specifics_t *specs =
-        (const asn_SEQUENCE_specifics_t *)td->specifics;
-    asn_random_fill_result_t result_ok = {ARFILL_OK, 0};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    void *st = *sptr;
-    size_t edx;
-
-    if(max_length == 0) return result_skipped;
-
-    (void)constr;
-
-    if(st == NULL) {
-        st = CALLOC(1, specs->struct_size);
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    for(edx = 0; edx < td->elements_count; edx++) {
-        const asn_TYPE_member_t *elm = &td->elements[edx];
-        void *memb_ptr;   /* Pointer to the member */
-        void **memb_ptr2; /* Pointer to that pointer */
-        asn_random_fill_result_t tmpres;
-
-        if(elm->optional && asn_random_between(0, 4) == 2) {
-            /* Sometimes decide not to fill the optional value */
-            continue;
-        }
-
-        if(elm->flags & ATF_POINTER) {
-            /* Member is a pointer to another structure */
-            memb_ptr2 = (void **)((char *)st + elm->memb_offset);
-        } else {
-            memb_ptr = (char *)st + elm->memb_offset;
-            memb_ptr2 = &memb_ptr;
-        }
-
-        tmpres = elm->type->op->random_fill(
-            elm->type, memb_ptr2, &elm->encoding_constraints,
-            max_length > result_ok.length ? max_length - result_ok.length : 0);
-        switch(tmpres.code) {
-        case ARFILL_OK:
-            result_ok.length += tmpres.length;
-            continue;
-        case ARFILL_SKIPPED:
-            assert(!(elm->flags & ATF_POINTER) || *memb_ptr2 == NULL);
-            continue;
-        case ARFILL_FAILED:
-            if(st == *sptr) {
-                ASN_STRUCT_RESET(*td, st);
-            } else {
-                ASN_STRUCT_FREE(*td, st);
-            }
-            return tmpres;
-        }
-    }
-
-    *sptr = st;
-
-    return result_ok;
-}
index 52e6c071ecacb400552fc30259adb2c110f5e942..e90c821d8fa70731ff43f5b24302e66ed7bd029f 100644 (file)
@@ -39,7 +39,6 @@ asn_constr_check_f SEQUENCE_constraint;
 ber_type_decoder_f SEQUENCE_decode_ber;
 der_type_encoder_f SEQUENCE_encode_der;
 xer_type_encoder_f SEQUENCE_encode_xer;
-asn_random_fill_f  SEQUENCE_random_fill;
 extern asn_TYPE_operation_t asn_OP_SEQUENCE;
 
 #endif /* _CONSTR_SEQUENCE_H_ */
index b0eedc0161f5a49bf184d2ae31525b40541e106d..34d9e4ceebd8f15c09ae517859a05dda22460e03 100644 (file)
@@ -175,6 +175,5 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
        SEQUENCE_OF_decode_ber,
        SEQUENCE_OF_encode_der,
        SEQUENCE_OF_encode_xer,
-       SEQUENCE_OF_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
index cc288f296a220e63e32d0be2add8eba71ae87784..fb15dd976d1c119863524073b6fd77f2ccdf3ba6 100644 (file)
@@ -21,6 +21,5 @@ extern asn_TYPE_operation_t asn_OP_SEQUENCE_OF;
 #define        SEQUENCE_OF_print       SET_OF_print
 #define        SEQUENCE_OF_constraint  SET_OF_constraint
 #define        SEQUENCE_OF_decode_ber  SET_OF_decode_ber
-#define        SEQUENCE_OF_random_fill SET_OF_random_fill
 
 #endif /* _CONSTR_SET_OF_H_ */
index e0cb57f83c7d49b2a476a8978760fe214bc8b5af..ef4b3fee671ec7b3aa1d7cc1a74ed54b1c8be4c5 100644 (file)
@@ -822,93 +822,5 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
        SET_OF_decode_ber,
        SET_OF_encode_der,
        SET_OF_encode_xer,
-       SET_OF_random_fill,
        0       /* Use generic outmost tag fetcher */
 };
-
-
-asn_random_fill_result_t
-SET_OF_random_fill(const asn_TYPE_descriptor_t *td, void **sptr,
-                   const asn_encoding_constraints_t *constraints,
-                   size_t max_length) {
-    const asn_SET_OF_specifics_t *specs =
-        (const asn_SET_OF_specifics_t *)td->specifics;
-    asn_random_fill_result_t res_ok = {ARFILL_OK, 0};
-    asn_random_fill_result_t result_failed = {ARFILL_FAILED, 0};
-    asn_random_fill_result_t result_skipped = {ARFILL_SKIPPED, 0};
-    const asn_TYPE_member_t *elm = td->elements;
-    void *st = *sptr;
-    long max_elements = 5;
-    long slb = 0;   /* Lower size bound */
-    long sub = 0;   /* Upper size bound */
-    size_t rnd_len;
-
-    if(max_length == 0) return result_skipped;
-
-    if(st == NULL) {
-        st = (*sptr = CALLOC(1, specs->struct_size));
-        if(st == NULL) {
-            return result_failed;
-        }
-    }
-
-    switch(asn_random_between(0, 6)) {
-    case 0: max_elements = 0; break;
-    case 1: max_elements = 1; break;
-    case 2: max_elements = 5; break;
-    case 3: max_elements = max_length; break;
-    case 4: max_elements = max_length / 2; break;
-    case 5: max_elements = max_length / 4; break;
-    default: break;
-    }
-    sub = slb + max_elements;
-
-    /* Bias towards edges of allowed space */
-    switch(asn_random_between(-1, 4)) {
-    default:
-    case -1:
-    case 0:
-        rnd_len = asn_random_between(slb, sub);
-        break;
-    case 1:
-        if(slb < sub) {
-            rnd_len = asn_random_between(slb + 1, sub);
-            break;
-        }
-        /* Fall through */
-    case 2:
-        rnd_len = asn_random_between(slb, slb);
-        break;
-    case 3:
-        if(slb < sub) {
-            rnd_len = asn_random_between(slb, sub - 1);
-            break;
-        }
-        /* Fall through */
-    case 4:
-        rnd_len = asn_random_between(sub, sub);
-        break;
-    }
-
-    for(; rnd_len > 0; rnd_len--) {
-        asn_anonymous_set_ *list = _A_SET_FROM_VOID(st);
-        void *ptr = 0;
-        asn_random_fill_result_t tmpres = elm->type->op->random_fill(
-            elm->type, &ptr, &elm->encoding_constraints,
-            (max_length > res_ok.length ? max_length - res_ok.length : 0)
-                / rnd_len);
-        switch(tmpres.code) {
-        case ARFILL_OK:
-            ASN_SET_ADD(list, ptr);
-            res_ok.length += tmpres.length;
-            break;
-        case ARFILL_SKIPPED:
-            break;
-        case ARFILL_FAILED:
-            assert(ptr == 0);
-            return tmpres;
-        }
-    }
-
-    return res_ok;
-}
index 785b2c0c2bfab14b009424b8e8d6a61f50127838..ee09914e65d3c4f78f0dde2d12e0c9f4196caf0c 100644 (file)
@@ -28,7 +28,6 @@ asn_constr_check_f SET_OF_constraint;
 ber_type_decoder_f SET_OF_decode_ber;
 der_type_encoder_f SET_OF_encode_der;
 xer_type_encoder_f SET_OF_encode_xer;
-asn_random_fill_f  SET_OF_random_fill;
 extern asn_TYPE_operation_t asn_OP_SET_OF;
 
 #endif /* CONSTR_SET_OF_H */
index 26b3fa59a06eac16d223c82a8bdd5e886c6b8d7c..e1d9c982280eb8a8342de0054776b482cbc4877b 100644 (file)
@@ -34,7 +34,6 @@ typedef struct asn_struct_ctx_s {
 #include "asn1/asn1c/der_encoder.h"    /* Distinguished Encoding Rules encoder */
 #include "asn1/asn1c/xer_encoder.h"    /* Encoder into XER (XML, text) */
 #include "asn1/asn1c/constraints.h"    /* Subtype constraints support */
-#include "asn1/asn1c/asn_random_fill.h"        /* Random structures support */
 
 /*
  * Free the structure according to its specification.
@@ -132,7 +131,6 @@ typedef struct asn_TYPE_operation_s {
     ber_type_decoder_f *ber_decoder;      /* Generic BER decoder */
     der_type_encoder_f *der_encoder;      /* Canonical DER encoder */
     xer_type_encoder_f *xer_encoder;      /* [Canonical] XER encoder */
-    asn_random_fill_f *random_fill;       /* Initialize with a random value */
     asn_outmost_tag_f *outmost_tag;       /* <optional, internal> */
 } asn_TYPE_operation_t;