Changeset 679 in openpam for trunk/lib


Ignore:
Timestamp:
Mar 18, 2013, 9:38:58 PM (8 years ago)
Author:
Dag-Erling Smørgrav
Message:

Clean up and simplify dummy key handling.

Location:
trunk/lib/liboath
Files:
3 edited

Legend:

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

    r646 r679  
    128128        if (k->counter >= UINT64_MAX - window)
    129129                return (-1);
    130         dummy = (memcmp(k->label, DUMMY_LABEL, DUMMY_LABELLEN) == 0);
     130        dummy = (strcmp(k->label, OATH_DUMMY_LABEL) == 0);
    131131        for (int i = 0; i < window; ++i) {
    132132                code = oath_hotp(k->key, k->keylen, k->counter + i, k->digits);
  • trunk/lib/liboath/oath_key.c

    r678 r679  
    311311        key->timestep = 30;
    312312        key->hash = hash;
    313         memcpy(key->label, DUMMY_LABEL, DUMMY_LABELLEN);
    314         key->labellen = DUMMY_LABELLEN;
    315         key->keylen = DUMMY_KEYLEN;
     313        strcpy(key->label, "oath-dummy-key");
     314        key->labellen = strlen(key->label);
     315        key->keylen = sizeof key->key;
    316316        return (key);
    317317}
  • trunk/lib/liboath/oath_totp.c

    r646 r679  
    8484                return (-1);
    8585        seq = time(NULL) / k->timestep;
    86         dummy = (memcmp(k->label, DUMMY_LABEL, DUMMY_LABELLEN) == 0);
     86        dummy = (strcmp(k->label, OATH_DUMMY_LABEL) == 0);
    8787        for (int i = -window; i <= window; ++i) {
    8888                code = oath_hotp(k->key, k->keylen, seq + i, k->digits);
Note: See TracChangeset for help on using the changeset viewer.