Lines Matching refs:item
69 static unsigned long items_fwd_hash(const SRTM_ITEM *item) in items_fwd_hash() argument
71 return (unsigned long)(uintptr_t)item->opaque; in items_fwd_hash()
79 static unsigned long items_rev_hash(const SRTM_ITEM *item) in items_rev_hash() argument
87 memcpy(&l, item->srt_blinded, sizeof(l)); in items_rev_hash()
154 SRTM_ITEM *inext, *item = ihead; in srtm_free_each() local
156 for (item = item->next_by_seq_num; item != NULL; item = inext) { in srtm_free_each()
157 inext = item->next_by_seq_num; in srtm_free_each()
158 OPENSSL_free(item); in srtm_free_each()
189 SRTM_ITEM key, *item = NULL, *prev = NULL; in srtm_find() local
193 item = lh_SRTM_ITEM_retrieve(srtm->items_fwd, &key); in srtm_find()
195 *head_p = item; in srtm_find()
197 for (; item != NULL; prev = item, item = item->next_by_seq_num) in srtm_find()
198 if (item->seq_num == seq_num) { in srtm_find()
200 } else if (item->seq_num < seq_num) { in srtm_find()
205 item = NULL; in srtm_find()
212 return item; in srtm_find()
220 static void sorted_insert_seq_num(SRTM_ITEM *head, SRTM_ITEM *item, SRTM_ITEM **new_head) in sorted_insert_seq_num() argument
222 uint64_t seq_num = item->seq_num; in sorted_insert_seq_num()
232 item->next_by_seq_num = *fixup; in sorted_insert_seq_num()
233 *fixup = item; in sorted_insert_seq_num()
241 static void sorted_insert_srt(SRTM_ITEM *head, SRTM_ITEM *item, SRTM_ITEM **new_head) in sorted_insert_srt() argument
243 uintptr_t opaque = (uintptr_t)item->opaque; in sorted_insert_srt()
253 item->next_by_srt_blinded = *fixup; in sorted_insert_srt()
254 *fixup = item; in sorted_insert_srt()
262 static int srtm_compute_blinded(QUIC_SRTM *srtm, SRTM_ITEM *item, in srtm_compute_blinded() argument
272 if (!EVP_EncryptUpdate(srtm->blind_ctx, item->srt_blinded, &outl, in srtm_compute_blinded()
285 SRTM_ITEM *item = NULL, *head = NULL, *new_head, *r_item; in ossl_quic_srtm_add() local
291 if ((item = srtm_find(srtm, opaque, seq_num, &head, NULL)) != NULL) in ossl_quic_srtm_add()
294 if ((item = OPENSSL_zalloc(sizeof(*item))) == NULL) in ossl_quic_srtm_add()
297 item->opaque = opaque; in ossl_quic_srtm_add()
298 item->seq_num = seq_num; in ossl_quic_srtm_add()
299 item->srt = *token; in ossl_quic_srtm_add()
300 if (!srtm_compute_blinded(srtm, item, &item->srt)) { in ossl_quic_srtm_add()
301 OPENSSL_free(item); in ossl_quic_srtm_add()
308 lh_SRTM_ITEM_insert(srtm->items_fwd, item); in ossl_quic_srtm_add()
310 OPENSSL_free(item); in ossl_quic_srtm_add()
314 sorted_insert_seq_num(head, item, &new_head); in ossl_quic_srtm_add()
318 OPENSSL_free(item); in ossl_quic_srtm_add()
325 r_item = lh_SRTM_ITEM_retrieve(srtm->items_rev, item); in ossl_quic_srtm_add()
328 lh_SRTM_ITEM_insert(srtm->items_rev, item); in ossl_quic_srtm_add()
338 sorted_insert_srt(r_item, item, &new_head); in ossl_quic_srtm_add()
351 static int srtm_remove_from_rev(QUIC_SRTM *srtm, SRTM_ITEM *item) in srtm_remove_from_rev() argument
355 rh_item = lh_SRTM_ITEM_retrieve(srtm->items_rev, item); in srtm_remove_from_rev()
357 if (rh_item == item) { in srtm_remove_from_rev()
362 if (item->next_by_srt_blinded != NULL) { in srtm_remove_from_rev()
363 lh_SRTM_ITEM_insert(srtm->items_rev, item->next_by_srt_blinded); in srtm_remove_from_rev()
367 lh_SRTM_ITEM_delete(srtm->items_rev, item); in srtm_remove_from_rev()
371 for (; rh_item->next_by_srt_blinded != item; in srtm_remove_from_rev()
373 rh_item->next_by_srt_blinded = item->next_by_srt_blinded; in srtm_remove_from_rev()
381 SRTM_ITEM *item, *prev = NULL; in ossl_quic_srtm_remove() local
386 if ((item = srtm_find(srtm, opaque, seq_num, NULL, &prev)) == NULL) in ossl_quic_srtm_remove()
396 if (item->next_by_seq_num != NULL) { in ossl_quic_srtm_remove()
397 lh_SRTM_ITEM_insert(srtm->items_fwd, item->next_by_seq_num); in ossl_quic_srtm_remove()
401 lh_SRTM_ITEM_delete(srtm->items_fwd, item); in ossl_quic_srtm_remove()
404 prev->next_by_seq_num = item->next_by_seq_num; in ossl_quic_srtm_remove()
408 if (!srtm_remove_from_rev(srtm, item)) in ossl_quic_srtm_remove()
411 OPENSSL_free(item); in ossl_quic_srtm_remove()
417 SRTM_ITEM key, *item = NULL, *inext, *ihead; in ossl_quic_srtm_cull() local
427 for (item = ihead; item != NULL; item = inext) { in ossl_quic_srtm_cull()
428 inext = item->next_by_seq_num; in ossl_quic_srtm_cull()
429 if (item != ihead) { in ossl_quic_srtm_cull()
430 srtm_remove_from_rev(srtm, item); in ossl_quic_srtm_cull()
431 OPENSSL_free(item); in ossl_quic_srtm_cull()
446 SRTM_ITEM key, *item; in ossl_quic_srtm_lookup() local
454 item = lh_SRTM_ITEM_retrieve(srtm->items_rev, &key); in ossl_quic_srtm_lookup()
455 for (; idx > 0 && item != NULL; --idx, item = item->next_by_srt_blinded); in ossl_quic_srtm_lookup()
456 if (item == NULL) in ossl_quic_srtm_lookup()
460 *opaque = item->opaque; in ossl_quic_srtm_lookup()
462 *seq_num = item->seq_num; in ossl_quic_srtm_lookup()
477 static void check_mark(SRTM_ITEM *item, void *arg) in check_mark() argument
485 assert(item != NULL); in check_mark()
487 while (item != NULL) { in check_mark()
489 assert(!(item->opaque == prev_opaque && item->seq_num == prev_seq_num)); in check_mark()
491 assert(item->opaque != prev_opaque || item->seq_num < prev_seq_num); in check_mark()
495 item->debug_token = token; in check_mark()
496 prev_opaque = item->opaque; in check_mark()
497 prev_seq_num = item->seq_num; in check_mark()
501 item = item->next_by_srt_blinded; in check_mark()
503 item = item->next_by_seq_num; in check_mark()
507 static void check_count(SRTM_ITEM *item, void *arg) in check_count() argument
512 assert(item != NULL); in check_count()
514 while (item != NULL) { in check_count()
516 assert(item->debug_token == token); in check_count()
519 item = item->next_by_seq_num; in check_count()
521 item = item->next_by_srt_blinded; in check_count()