Changeset 729 in openpam for trunk/lib


Ignore:
Timestamp:
Aug 21, 2013, 3:32:14 PM (7 years ago)
Author:
Dag-Erling Smørgrav
Message:

Keep track of when a TOTP key was last used and prevent reuse of the same
sequence number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/liboath/oath_totp.c

    r726 r729  
    8989        seq = time(NULL) / k->timestep;
    9090        for (int i = -window; i <= window; ++i) {
    91 #if OATH_TOTP_PREVENT_REUSE
    92                 /* XXX disabled for now, should be a key parameter? */
    93                 if (seq + i <= k->lastuse)
     91                if (seq + i <= k->lastused)
    9492                        continue;
    95 #endif
    9693                code = oath_hotp(k->key, k->keylen, seq + i, k->digits);
    9794                if (code == response && !k->dummy) {
    98                         k->lastuse = seq;
     95                        k->lastused = seq;
    9996                        return (1);
    10097                }
Note: See TracChangeset for help on using the changeset viewer.