Lines Matching defs:sq
194 samplequeue_release(isc_entropy_t *ent, sample_queue_t *sq) {
195 REQUIRE(sq->samples != NULL);
196 REQUIRE(sq->extra != NULL);
198 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
199 isc_mem_put(ent->mctx, sq->extra, RND_EVENTQSIZE * 4);
200 sq->samples = NULL;
201 sq->extra = NULL;
205 samplesource_allocate(isc_entropy_t *ent, sample_queue_t *sq) {
206 sq->samples = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
207 if (sq->samples == NULL)
210 sq->extra = isc_mem_get(ent->mctx, RND_EVENTQSIZE * 4);
211 if (sq->extra == NULL) {
212 isc_mem_put(ent->mctx, sq->samples, RND_EVENTQSIZE * 4);
213 sq->samples = NULL;
217 sq->nsamples = 0;
391 estimate_entropy(sample_queue_t *sq, isc_uint32_t t) {
400 if (t < sq->last_time)
401 delta = UINT_MAX - sq->last_time + t;
403 delta = sq->last_time - t;
411 delta2 = sq->last_delta - delta;
415 delta3 = sq->last_delta2 - delta2;
419 sq->last_time = t;
420 sq->last_delta = delta;
421 sq->last_delta2 = delta2;
438 crunchsamples(isc_entropy_t *ent, sample_queue_t *sq) {
442 if (sq->nsamples < 6)
446 sq->last_time = sq->samples[0];
447 sq->last_delta = 0;
448 sq->last_delta2 = 0;
455 (void)estimate_entropy(sq, sq->samples[ns]);
457 for (ns = 4; ns < sq->nsamples; ns++)
458 added += estimate_entropy(sq, sq->samples[ns]);
460 entropypool_adddata(ent, sq->samples, sq->nsamples * 4, added);
461 entropypool_adddata(ent, sq->extra, sq->nsamples * 4, 0);
468 sq->samples[ns] = sq->samples[sq->nsamples - 4 + ns];
469 sq->extra[ns] = sq->extra[sq->nsamples - 4 + ns];
472 sq->nsamples = 4;
954 sample_queue_t *sq;
967 sq = &source->sources.sample.samplequeue;
968 result = samplesource_allocate(ent, sq);
1008 addsample(sample_queue_t *sq, isc_uint32_t sample, isc_uint32_t extra) {
1009 if (sq->nsamples >= RND_EVENTQSIZE)
1012 sq->samples[sq->nsamples] = sample;
1013 sq->extra[sq->nsamples] = extra;
1014 sq->nsamples++;
1016 if (sq->nsamples >= RND_EVENTQSIZE)
1027 sample_queue_t *sq;
1037 sq = &source->sources.sample.samplequeue;
1038 result = addsample(sq, sample, extra);
1040 entropy = crunchsamples(ent, sq);
1053 sample_queue_t *sq;
1059 sq = &source->sources.callback.samplequeue;
1060 result = addsample(sq, sample, extra);