Lines Matching defs:sq

190 samplequeue_release(isc_entropy_t *ent, sample_queue_t *sq) {
191 REQUIRE(sq->samples != NULL);
192 REQUIRE(sq->extra != NULL);
194 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
195 isc_mem_put(ent->mctx, sq->extra, RND_EVENTQSIZE * 4);
196 sq->samples = NULL;
197 sq->extra = NULL;
201 samplesource_allocate(isc_entropy_t *ent, sample_queue_t *sq) {
202 sq->samples = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
203 if (sq->samples == NULL)
206 sq->extra = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
207 if (sq->extra == NULL) {
208 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
209 sq->samples = NULL;
213 sq->nsamples = 0;
396 estimate_entropy(sample_queue_t *sq, isc_uint32_t t) {
405 if (t < sq->last_time)
406 delta = UINT_MAX - sq->last_time + t;
408 delta = sq->last_time - t;
416 delta2 = sq->last_delta - delta;
420 delta3 = sq->last_delta2 - delta2;
424 sq->last_time = t;
425 sq->last_delta = delta;
426 sq->last_delta2 = delta2;
443 crunchsamples(isc_entropy_t *ent, sample_queue_t *sq) {
447 if (sq->nsamples < 6)
451 sq->last_time = sq->samples[0];
452 sq->last_delta = 0;
453 sq->last_delta2 = 0;
460 (void)estimate_entropy(sq, sq->samples[ns]);
462 for (ns = 4; ns < sq->nsamples; ns++)
463 added += estimate_entropy(sq, sq->samples[ns]);
465 entropypool_adddata(ent, sq->samples, sq->nsamples * 4, added);
466 entropypool_adddata(ent, sq->extra, sq->nsamples * 4, 0);
473 sq->samples[ns] = sq->samples[sq->nsamples - 4 + ns];
474 sq->extra[ns] = sq->extra[sq->nsamples - 4 + ns];
477 sq->nsamples = 4;
958 sample_queue_t *sq;
971 sq = &source->sources.sample.samplequeue;
972 result = samplesource_allocate(ent, sq);
1012 addsample(sample_queue_t *sq, isc_uint32_t sample, isc_uint32_t extra) {
1013 if (sq->nsamples >= RND_EVENTQSIZE)
1016 sq->samples[sq->nsamples] = sample;
1017 sq->extra[sq->nsamples] = extra;
1018 sq->nsamples++;
1020 if (sq->nsamples >= RND_EVENTQSIZE)
1031 sample_queue_t *sq;
1041 sq = &source->sources.sample.samplequeue;
1042 result = addsample(sq, sample, extra);
1044 entropy = crunchsamples(ent, sq);
1057 sample_queue_t *sq;
1063 sq = &source->sources.callback.samplequeue;
1064 result = addsample(sq, sample, extra);