Ignore:
Timestamp:
Feb 7, 2019, 8:36:33 AM (5 years ago)
Author:
coas-nagasima
Message:

wolfsslを3.15.7にバージョンアップ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfcrypt/src/coding.c

    r352 r372  
    3737    BAD         = 0xFF,  /* invalid encoding */
    3838    PAD         = '=',
    39     PEM_LINE_SZ = 64
     39    PEM_LINE_SZ = 64,
     40    BASE64_MIN  = 0x2B,
     41    BASE16_MIN  = 0x30,
    4042};
    4143
     
    6062    word32 j = 0;
    6163    word32 plainSz = inLen - ((inLen + (PEM_LINE_SZ - 1)) / PEM_LINE_SZ );
    62     const byte maxIdx = (byte)sizeof(base64Decode) + 0x2B - 1;
     64    const byte maxIdx = (byte)sizeof(base64Decode) + BASE64_MIN - 1;
    6365
    6466    plainSz = (plainSz * 3 + 3) / 4;
     
    8284            pad4 = 1;
    8385
    84         if (e1 < 0x2B || e2 < 0x2B || e3 < 0x2B || e4 < 0x2B) {
     86        if (e1 < BASE64_MIN || e2 < BASE64_MIN || e3 < BASE64_MIN || e4 < BASE64_MIN) {
    8587            WOLFSSL_MSG("Bad Base64 Decode data, too small");
    8688            return ASN_INPUT_E;
     
    9294        }
    9395
    94         e1 = base64Decode[e1 - 0x2B];
    95         e2 = base64Decode[e2 - 0x2B];
    96         e3 = (e3 == PAD) ? 0 : base64Decode[e3 - 0x2B];
    97         e4 = (e4 == PAD) ? 0 : base64Decode[e4 - 0x2B];
     96        e1 = base64Decode[e1 - BASE64_MIN];
     97        e2 = base64Decode[e2 - BASE64_MIN];
     98        e3 = (e3 == PAD) ? 0 : base64Decode[e3 - BASE64_MIN];
     99        e4 = (e4 == PAD) ? 0 : base64Decode[e4 - BASE64_MIN];
    98100
    99101        b1 = (byte)((e1 << 2) | (e2 >> 4));
     
    345347}
    346348
    347 #endif  /* defined(WOLFSSL_BASE64_ENCODE) */
    348 
    349 
    350 #if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) || defined(HAVE_FIPS) \
    351                            || defined(HAVE_ECC_CDH)
     349#endif /* WOLFSSL_BASE64_ENCODE */
     350
     351
     352#ifdef WOLFSSL_BASE16
    352353
    353354static
     
    371372
    372373    if (inLen == 1 && *outLen && in) {
    373         byte b = in[inIdx++] - 0x30;  /* 0 starts at 0x30 */
     374        byte b = in[inIdx++] - BASE16_MIN;  /* 0 starts at 0x30 */
    374375
    375376        /* sanity check */
     
    395396
    396397    while (inLen) {
    397         byte b  = in[inIdx++] - 0x30;  /* 0 starts at 0x30 */
    398         byte b2 = in[inIdx++] - 0x30;
     398        byte b  = in[inIdx++] - BASE16_MIN;  /* 0 starts at 0x30 */
     399        byte b2 = in[inIdx++] - BASE16_MIN;
    399400
    400401        /* sanity checks */
     
    455456}
    456457
    457 #endif /* (OPENSSL_EXTRA) || (HAVE_WEBSERVER) || (HAVE_FIPS) */
    458 
    459 #endif /* NO_CODING */
     458#endif /* WOLFSSL_BASE16 */
     459
     460#endif /* !NO_CODING */
Note: See TracChangeset for help on using the changeset viewer.