Project

General

Profile

Bug #4092

Test RandomKeyId in TestBackEnds could randomly fail

Added by Jeff Thompson almost 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Security
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

The RandomKeyId test in TestBackEnds tests whether TpmBackEnd::createKey creates a unique random key name. It is only guaranteed to be unique relative to the key names already in the store. But the RandomKeyId test deletes the key on line 256 after is is created:
https://github.com/named-data/ndn-cxx/blob/1ece2e3744fa75bb5afc0c2199a86b0b27a4de03/tests/unit-tests/security/tpm/back-end.t.cpp#L256

tpm.deleteKey(keyName);

It is possible (through very unlikely) that TpmBackEnd::createKey could generated the same key again and the test would fail. The purpose of the test is to test that createKey guarantees unique key names in the store. Its purpose is not to test the quality of the random number generator. The test is already checking for unique names by using the keyNames set. Suggestion: Simply remove deleteKey on line 256.

#1

Updated by Junxiao Shi over 3 years ago

  • Category set to Security
#2

Updated by Junxiao Shi over 2 years ago

  • Status changed from New to Code review
  • Assignee set to Junxiao Shi
  • Target version set to v0.7
  • % Done changed from 0 to 100
#3

Updated by Davide Pesavento over 2 years ago

  • Status changed from Code review to Closed
  • Start date deleted (05/24/2017)

Also available in: Atom PDF