Changeset 779 in openpam for trunk/lib/liboath/oath_base64.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_base64.c

    r776 r779  
    8888 */
    8989int
    90 base64_enc(const char *in, size_t ilen, char *out, size_t *olen)
     90base64_enc(const char *cin, size_t ilen, char *out, size_t *olen)
    9191{
     92        const uint8_t *in = (uint8_t *)cin;
    9293        uint32_t bits;
    9394
     
    149150 */
    150151int
    151 base64_dec(const char *in, size_t ilen, char *out, size_t *olen)
     152base64_dec(const char *cin, size_t ilen, char *out, size_t *olen)
    152153{
     154        const uint8_t *in = (uint8_t *)cin;
    153155        size_t len;
    154156        int bits, shift, padding;
     
    159161                        /* consume */
    160162                        continue;
    161                 } else if (!padding && b64dec[(int)*in] >= 0) {
     163                } else if (!padding && b64dec[*in] >= 0) {
    162164                        /* shift into accumulator */
    163165                        shift += 6;
    164                         bits = bits << 6 | b64dec[(int)*in];
     166                        bits = bits << 6 | b64dec[*in];
    165167                } else if (!padding && shift > 0 && shift != 6 && *in == '=') {
    166168                        /* final byte */
Note: See TracChangeset for help on using the changeset viewer.