17 if(lb < ub)
return lb + 1;
22 if(lb < ub)
return ub - 1;
41 unsigned int unit_bytes = 1;
42 unsigned long clb = 0;
43 unsigned long cub = 255;
50 if(max_length == 0 && !*sptr)
return result_skipped;
52 switch(specs->subvariant) {
76 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
77 if(!constraints || !constraints->per_constraints)
78 constraints = &td->encoding_constraints;
79 if(constraints->per_constraints) {
81 if(pc->
flags & APC_SEMI_CONSTRAINED) {
83 }
else if(pc->
flags & APC_CONSTRAINED) {
89 if(!constraints) constraints = &td->encoding_constraints;
95 buf =
CALLOC(unit_bytes, rnd_len + 1);
96 if(!buf)
return result_failed;
98 bend = &buf[unit_bytes * rnd_len];
102 for(b = buf; b < bend; b += unit_bytes) {
108 for(b = buf; b < bend; b += unit_bytes) {
116 for(b = buf; b < bend; b += unit_bytes) {
134 return result_failed;
139 st->
size = unit_bytes * rnd_len;
141 result_ok.length = st->
size;
149 const unsigned lengths[] = {0, 1, 2, 3, 4, 8,
150 126, 127, 128, 16383, 16384, 16385,
151 65534, 65535, 65536, 65537};
156 0,
sizeof(lengths) /
sizeof(lengths[0]) - 1)];
158 #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT)
163 if(pc->
flags & APC_CONSTRAINED) {
164 long suggested_upper_bound = pc->
upper_bound < (ssize_t)max_length
166 : (ssize_t)max_length;
170 if(pc->
flags & APC_EXTENSIBLE) {
183 if(rnd_len <= max_length) {
189 suggested_upper_bound);
203 if(rnd_len > max_length) {