Page MenuHome GnuPG

agent: Fix S2K calibration.
AbandonedPublic

Authored by gniibe on Oct 29 2017, 12:52 PM.

Details

Summary
  • agent/protect.c (calibrate_get_time): Use clock_gettime when the

CLOCK_THREAD_PROCESS_ID clock is available. On non-W32 systems,
store time directly as milliseconds instead of clock ticks.
(calibrate_elapsed_time): Fix computation of elapsed time accordingly.

(struct calibrate_time_s): Rename member ticks to ms.

GnuPG-bug-id: 3276
Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>

Test Plan

Run the agent/t-protect test program and check the time needed for the calibration. In particular, check that the program does not remain stuck indefinitely in the calibration loop.

Tested on a Linux-4.11.7 kernel with the VIRT_CPU_ACCOUNTING_GEN option enabled (a configuration known to trigger the reported bug). Also tested on Linux-4.13.2 but the bug does not seem to manifest itself under that kernel, with or without this patch.

Diff Detail

Repository
rG GnuPG
Lint
Lint Skipped
Unit
Unit Tests Skipped