Lines Matching refs:rd
56 mbedtls_mps_reader const *rd) in mps_reader_is_accumulating() argument
59 if (rd->acc == NULL) { in mps_reader_is_accumulating()
63 acc_remaining = rd->acc_share.acc_remaining; in mps_reader_is_accumulating()
68 mbedtls_mps_reader const *rd) in mps_reader_is_producing() argument
70 unsigned char *frag = rd->frag; in mps_reader_is_producing()
75 mbedtls_mps_reader const *rd) in mps_reader_is_consuming() argument
77 return !mps_reader_is_producing(rd); in mps_reader_is_consuming()
81 mbedtls_mps_reader const *rd) in mps_reader_get_fragment_offset() argument
83 unsigned char *acc = rd->acc; in mps_reader_get_fragment_offset()
90 frag_offset = rd->acc_share.frag_offset; in mps_reader_get_fragment_offset()
95 mbedtls_mps_reader const *rd) in mps_reader_serving_from_accumulator() argument
99 frag_offset = mps_reader_get_fragment_offset(rd); in mps_reader_serving_from_accumulator()
100 end = rd->end; in mps_reader_serving_from_accumulator()
105 static inline void mps_reader_zero(mbedtls_mps_reader *rd) in mps_reader_zero() argument
123 *rd = zero; in mps_reader_zero()
126 int mbedtls_mps_reader_init(mbedtls_mps_reader *rd, in mbedtls_mps_reader_init() argument
133 mps_reader_zero(rd); in mbedtls_mps_reader_init()
134 rd->acc = acc; in mbedtls_mps_reader_init()
135 rd->acc_len = acc_len; in mbedtls_mps_reader_init()
139 int mbedtls_mps_reader_free(mbedtls_mps_reader *rd) in mbedtls_mps_reader_free() argument
142 mps_reader_zero(rd); in mbedtls_mps_reader_free()
146 int mbedtls_mps_reader_feed(mbedtls_mps_reader *rd, in mbedtls_mps_reader_feed() argument
160 rd), in mbedtls_mps_reader_feed()
163 if (mps_reader_is_accumulating(rd)) { in mbedtls_mps_reader_feed()
164 unsigned char *acc = rd->acc; in mbedtls_mps_reader_feed()
165 mbedtls_mps_size_t acc_remaining = rd->acc_share.acc_remaining; in mbedtls_mps_reader_feed()
166 mbedtls_mps_size_t acc_available = rd->acc_available; in mbedtls_mps_reader_feed()
189 rd->acc_share.acc_remaining = acc_remaining; in mbedtls_mps_reader_feed()
190 rd->acc_available = acc_available; in mbedtls_mps_reader_feed()
200 rd->acc_share.frag_offset = acc_available; in mbedtls_mps_reader_feed()
202 rd->acc_available = acc_available; in mbedtls_mps_reader_feed()
204 rd->acc_share.frag_offset = 0; in mbedtls_mps_reader_feed()
207 rd->frag = new_frag; in mbedtls_mps_reader_feed()
208 rd->frag_len = new_frag_len; in mbedtls_mps_reader_feed()
209 rd->commit = 0; in mbedtls_mps_reader_feed()
210 rd->end = 0; in mbedtls_mps_reader_feed()
215 int mbedtls_mps_reader_get(mbedtls_mps_reader *rd, in mbedtls_mps_reader_get() argument
227 rd), in mbedtls_mps_reader_get()
230 end = rd->end; in mbedtls_mps_reader_get()
231 frag_offset = mps_reader_get_fragment_offset(rd); in mbedtls_mps_reader_get()
234 if (mps_reader_serving_from_accumulator(rd)) { in mbedtls_mps_reader_get()
304 acc_available = rd->acc_available; in mbedtls_mps_reader_get()
321 acc = rd->acc; in mbedtls_mps_reader_get()
330 rd->end = end; in mbedtls_mps_reader_get()
331 rd->pending = 0; in mbedtls_mps_reader_get()
340 frag_len = rd->frag_len; in mbedtls_mps_reader_get()
355 rd->pending = desired - frag_remaining; in mbedtls_mps_reader_get()
358 (unsigned) rd->pending); in mbedtls_mps_reader_get()
369 frag = rd->frag; in mbedtls_mps_reader_get()
378 rd->end = end; in mbedtls_mps_reader_get()
379 rd->pending = 0; in mbedtls_mps_reader_get()
383 int mbedtls_mps_reader_commit(mbedtls_mps_reader *rd) in mbedtls_mps_reader_commit() argument
388 rd), in mbedtls_mps_reader_commit()
391 end = rd->end; in mbedtls_mps_reader_commit()
392 rd->commit = end; in mbedtls_mps_reader_commit()
397 int mbedtls_mps_reader_reclaim(mbedtls_mps_reader *rd, in mbedtls_mps_reader_reclaim() argument
410 rd), in mbedtls_mps_reader_reclaim()
413 frag = rd->frag; in mbedtls_mps_reader_reclaim()
414 acc = rd->acc; in mbedtls_mps_reader_reclaim()
415 pending = rd->pending; in mbedtls_mps_reader_reclaim()
416 commit = rd->commit; in mbedtls_mps_reader_reclaim()
417 frag_len = rd->frag_len; in mbedtls_mps_reader_reclaim()
419 frag_offset = mps_reader_get_fragment_offset(rd); in mbedtls_mps_reader_reclaim()
429 rd->end = commit; in mbedtls_mps_reader_reclaim()
433 rd->acc_available = 0; in mbedtls_mps_reader_reclaim()
434 rd->acc_share.acc_remaining = 0; in mbedtls_mps_reader_reclaim()
459 acc_len = rd->acc_len; in mbedtls_mps_reader_reclaim()
488 rd->end = commit; in mbedtls_mps_reader_reclaim()
489 rd->pending = 0; in mbedtls_mps_reader_reclaim()
516 rd->acc_available = backup_len; in mbedtls_mps_reader_reclaim()
517 rd->acc_share.acc_remaining = pending; in mbedtls_mps_reader_reclaim()
524 rd->frag = NULL; in mbedtls_mps_reader_reclaim()
525 rd->frag_len = 0; in mbedtls_mps_reader_reclaim()
527 rd->commit = 0; in mbedtls_mps_reader_reclaim()
528 rd->end = 0; in mbedtls_mps_reader_reclaim()
529 rd->pending = 0; in mbedtls_mps_reader_reclaim()
533 (unsigned) rd->acc_available, (unsigned) rd->acc_len, in mbedtls_mps_reader_reclaim()
534 (unsigned) rd->acc_share.acc_remaining); in mbedtls_mps_reader_reclaim()