Changeset 849 in openpam for trunk/lib


Ignore:
Timestamp:
Dec 15, 2014, 4:42:31 PM (6 years ago)
Author:
Dag-Erling Smørgrav
Message:

Change the meaning of the window parameter to always indicate the number
of codes to check *in addition* to the current code. Note that for TOTP,
the window goes in both directions; a window of 1 means to check the
current code plus the previous and next.

Location:
trunk/lib/liboath
Files:
2 edited

Legend:

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

    r848 r849  
    122122        if (k == NULL)
    123123                return (-1);
    124         if (window < 1)
     124        if (window < 0)
    125125                return (-1);
    126126        if (k->mode != om_hotp)
    127127                return (-1);
    128         if (k->counter >= UINT64_MAX - window)
     128        if (k->counter >= UINT64_MAX - window - 1)
    129129                return (-1);
    130         for (int i = 0; i < window; ++i) {
     130        for (int i = 0; i <= window; ++i) {
    131131                code = oath_hotp(k->key, k->keylen, k->counter + i, k->digits);
    132132                if (code == response && !k->dummy) {
  • trunk/lib/liboath/oath_totp.c

    r848 r849  
    8282        if (k == NULL)
    8383                return (-1);
    84         if (window < 1)
     84        if (window < 0)
    8585                return (-1);
    8686        if (k->mode != om_totp)
Note: See TracChangeset for help on using the changeset viewer.