Changeset 779 in openpam for trunk/lib/liboath/oath_base32.c


Ignore:
Timestamp:
Mar 9, 2014, 2:11:44 PM (7 years ago)
Author:
Dag-Erling Smørgrav
Message:

When I changed the argument type from uint8_t * to char *, I forgot that
they were being used as array indices. Cast them back to uint8_t.

File:
1 edited

Legend:

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

    r776 r779  
    8686 */
    8787int
    88 base32_enc(const char *in, size_t ilen, char *out, size_t *olen)
     88base32_enc(const char *cin, size_t ilen, char *out, size_t *olen)
    8989{
     90        const uint8_t *in = (uint8_t *)cin;
    9091        uint64_t bits;
    9192
     
    161162 */
    162163int
    163 base32_dec(const char *in, size_t ilen, char *out, size_t *olen)
     164base32_dec(const char *cin, size_t ilen, char *out, size_t *olen)
    164165{
     166        const uint8_t *in = (uint8_t *)cin;
    165167        size_t len;
    166168        int bits, shift, padding;
     
    171173                        /* consume */
    172174                        continue;
    173                 } else if (!padding && b32dec[(int)*in] >= 0) {
     175                } else if (!padding && b32dec[*in] >= 0) {
    174176                        /* shift into accumulator */
    175177                        shift += 5;
    176                         bits = bits << 5 | b32dec[(int)*in];
     178                        bits = bits << 5 | b32dec[*in];
    177179                } else if (!padding && shift > 0 && shift < 5 && *in == '=') {
    178180                        /* final byte */
Note: See TracChangeset for help on using the changeset viewer.