Lines Matching refs:srtm
100 static int srtm_check_lh(QUIC_SRTM *srtm, LHASH_OF(SRTM_ITEM) *lh) in srtm_check_lh() argument
103 srtm->alloc_failed = 1; in srtm_check_lh()
112 QUIC_SRTM *srtm = NULL; in ossl_quic_srtm_new() local
119 if ((srtm = OPENSSL_zalloc(sizeof(*srtm))) == NULL) in ossl_quic_srtm_new()
126 if ((srtm->blind_ctx = EVP_CIPHER_CTX_new()) == NULL) in ossl_quic_srtm_new()
129 if (!EVP_EncryptInit_ex2(srtm->blind_ctx, ecb, key, NULL, NULL)) in ossl_quic_srtm_new()
136 if ((srtm->items_fwd = lh_SRTM_ITEM_new(items_fwd_hash, items_fwd_cmp)) == NULL in ossl_quic_srtm_new()
137 || (srtm->items_rev = lh_SRTM_ITEM_new(items_rev_hash, items_rev_cmp)) == NULL) in ossl_quic_srtm_new()
140 return srtm; in ossl_quic_srtm_new()
147 ossl_quic_srtm_free(srtm); in ossl_quic_srtm_new()
164 void ossl_quic_srtm_free(QUIC_SRTM *srtm) in ossl_quic_srtm_free() argument
166 if (srtm == NULL) in ossl_quic_srtm_free()
169 lh_SRTM_ITEM_free(srtm->items_rev); in ossl_quic_srtm_free()
170 if (srtm->items_fwd != NULL) { in ossl_quic_srtm_free()
171 lh_SRTM_ITEM_doall(srtm->items_fwd, srtm_free_each); in ossl_quic_srtm_free()
172 lh_SRTM_ITEM_free(srtm->items_fwd); in ossl_quic_srtm_free()
175 EVP_CIPHER_CTX_free(srtm->blind_ctx); in ossl_quic_srtm_free()
176 OPENSSL_free(srtm); in ossl_quic_srtm_free()
186 static SRTM_ITEM *srtm_find(QUIC_SRTM *srtm, void *opaque, uint64_t seq_num, in srtm_find() argument
193 item = lh_SRTM_ITEM_retrieve(srtm->items_fwd, &key); in srtm_find()
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()
282 int ossl_quic_srtm_add(QUIC_SRTM *srtm, void *opaque, uint64_t seq_num, in ossl_quic_srtm_add() argument
287 if (srtm->alloc_failed) in ossl_quic_srtm_add()
291 if ((item = srtm_find(srtm, opaque, seq_num, &head, NULL)) != NULL) in ossl_quic_srtm_add()
300 if (!srtm_compute_blinded(srtm, item, &item->srt)) { in ossl_quic_srtm_add()
308 lh_SRTM_ITEM_insert(srtm->items_fwd, item); in ossl_quic_srtm_add()
309 if (!srtm_check_lh(srtm, srtm->items_fwd)) { in ossl_quic_srtm_add()
316 lh_SRTM_ITEM_insert(srtm->items_fwd, new_head); in ossl_quic_srtm_add()
317 if (!srtm_check_lh(srtm, srtm->items_fwd)) { 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()
329 if (!srtm_check_lh(srtm, srtm->items_rev)) in ossl_quic_srtm_add()
340 lh_SRTM_ITEM_insert(srtm->items_rev, new_head); in ossl_quic_srtm_add()
341 if (!srtm_check_lh(srtm, srtm->items_rev)) 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()
363 lh_SRTM_ITEM_insert(srtm->items_rev, item->next_by_srt_blinded); in srtm_remove_from_rev()
364 if (!srtm_check_lh(srtm, srtm->items_rev)) in srtm_remove_from_rev()
367 lh_SRTM_ITEM_delete(srtm->items_rev, item); in srtm_remove_from_rev()
379 int ossl_quic_srtm_remove(QUIC_SRTM *srtm, void *opaque, uint64_t seq_num) in ossl_quic_srtm_remove() argument
383 if (srtm->alloc_failed) in ossl_quic_srtm_remove()
386 if ((item = srtm_find(srtm, opaque, seq_num, NULL, &prev)) == NULL) in ossl_quic_srtm_remove()
397 lh_SRTM_ITEM_insert(srtm->items_fwd, item->next_by_seq_num); in ossl_quic_srtm_remove()
398 if (!srtm_check_lh(srtm, srtm->items_fwd)) in ossl_quic_srtm_remove()
401 lh_SRTM_ITEM_delete(srtm->items_fwd, item); in ossl_quic_srtm_remove()
408 if (!srtm_remove_from_rev(srtm, item)) in ossl_quic_srtm_remove()
415 int ossl_quic_srtm_cull(QUIC_SRTM *srtm, void *opaque) in ossl_quic_srtm_cull() argument
421 if (srtm->alloc_failed) in ossl_quic_srtm_cull()
424 if ((ihead = lh_SRTM_ITEM_retrieve(srtm->items_fwd, &key)) == NULL) in ossl_quic_srtm_cull()
430 srtm_remove_from_rev(srtm, item); in ossl_quic_srtm_cull()
435 lh_SRTM_ITEM_delete(srtm->items_fwd, ihead); in ossl_quic_srtm_cull()
436 srtm_remove_from_rev(srtm, ihead); in ossl_quic_srtm_cull()
441 int ossl_quic_srtm_lookup(QUIC_SRTM *srtm, in ossl_quic_srtm_lookup() argument
448 if (srtm->alloc_failed) in ossl_quic_srtm_lookup()
451 if (!srtm_compute_blinded(srtm, &key, token)) in ossl_quic_srtm_lookup()
454 item = lh_SRTM_ITEM_retrieve(srtm->items_rev, &key); in ossl_quic_srtm_lookup()
527 void ossl_quic_srtm_check(const QUIC_SRTM *srtm) in ossl_quic_srtm_check() argument
536 assert(srtm != NULL); in ossl_quic_srtm_check()
537 assert(srtm->blind_ctx != NULL); in ossl_quic_srtm_check()
538 assert(srtm->items_fwd != NULL); in ossl_quic_srtm_check()
539 assert(srtm->items_rev != NULL); in ossl_quic_srtm_check()
542 lh_SRTM_ITEM_doall_arg(srtm->items_fwd, check_mark, &args); in ossl_quic_srtm_check()
546 lh_SRTM_ITEM_doall_arg(srtm->items_rev, check_count, &args); in ossl_quic_srtm_check()
556 lh_SRTM_ITEM_doall_arg(srtm->items_rev, check_mark, &args); in ossl_quic_srtm_check()
560 lh_SRTM_ITEM_doall_arg(srtm->items_fwd, check_count, &args); in ossl_quic_srtm_check()