mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-24 06:35:45 +00:00
Merge counter and lastused.
To prevent replay attacks, HOTP uses a counter, while TOTP keeps track of the time the key was last used. Since these values have the same type and are never used at the same time, merge them into an anonymous union.
This commit is contained in:
parent
a439adc68f
commit
4d76b664d2
1 changed files with 4 additions and 2 deletions
|
@ -47,9 +47,11 @@ typedef struct {
|
|||
oath_mode mode;
|
||||
oath_hash hash;
|
||||
unsigned int digits;
|
||||
uint64_t counter; /* HOTP only */
|
||||
union {
|
||||
uint64_t counter; /* HOTP */
|
||||
uint64_t lastused; /* TOTP */
|
||||
};
|
||||
unsigned int timestep; /* TOTP only - in seconds */
|
||||
uint64_t lastused; /* TOTP only */
|
||||
|
||||
/* housekeeping */
|
||||
unsigned int dummy:1; /* dummy key, always fail */
|
||||
|
|
Loading…
Reference in a new issue