19 static unsigned lengths[] = {0, 1, 2, 3, 4, 8,
20 126, 127, 128, 16383, 16384, 16385,
21 65534, 65535, 65536, 65537};
25 size_t rnd_bits, rnd_len;
28 if(max_length == 0)
return result_skipped;
30 switch(specs->subvariant) {
41 0,
sizeof(lengths) /
sizeof(lengths[0]) - 1)];
42 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
43 if(!constraints || !constraints->per_constraints)
44 constraints = &td->encoding_constraints;
45 if(constraints->per_constraints) {
47 if(pc->
flags & APC_CONSTRAINED) {
48 long suggested_upper_bound = pc->
upper_bound < (ssize_t)max_length
50 : (ssize_t)max_length;
52 return result_skipped;
54 if(pc->
flags & APC_EXTENSIBLE) {
67 if(rnd_bits < max_length) {
73 suggested_upper_bound);
84 if(!constraints) constraints = &td->encoding_constraints;
87 if(rnd_bits >= max_length) {
92 rnd_len = (rnd_bits + 7) / 8;
93 buf =
CALLOC(1, rnd_len + 1);
94 if(!buf)
return result_failed;
98 for(b = buf; b < bend; b++) {
110 return result_failed;
118 assert(st->
size > 0);
122 result_ok.length = st->
size;