diff options
Diffstat (limited to 'extra/yassl/taocrypt/src/coding.cpp')
-rw-r--r-- | extra/yassl/taocrypt/src/coding.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/extra/yassl/taocrypt/src/coding.cpp b/extra/yassl/taocrypt/src/coding.cpp index 7c6a6a8bd8b..8647ea13f20 100644 --- a/extra/yassl/taocrypt/src/coding.cpp +++ b/extra/yassl/taocrypt/src/coding.cpp @@ -95,7 +95,6 @@ void HexEncoder::Encode() void HexDecoder::Decode() { word32 bytes = coded_.size(); - assert((bytes % 2) == 0); decoded_.New(bytes / 2); word32 i(0); @@ -104,15 +103,9 @@ void HexDecoder::Decode() byte b = coded_.next() - 0x30; // 0 starts at 0x30 byte b2 = coded_.next() - 0x30; - // sanity checks - assert( b < sizeof(hexDecode)/sizeof(hexDecode[0]) ); - assert( b2 < sizeof(hexDecode)/sizeof(hexDecode[0]) ); - b = hexDecode[b]; b2 = hexDecode[b2]; - - assert( b != bad && b2 != bad ); - + decoded_[i++] = (b << 4) | b2; bytes -= 2; } @@ -174,9 +167,9 @@ void Base64Encoder::Encode() } encoded_[i++] = '\n'; - assert(i == outSz); - - plain_.reset(encoded_); + + if (i == outSz) + plain_.reset(encoded_); } @@ -197,7 +190,6 @@ void Base64Decoder::Decode() byte e3 = coded_.next(); byte e4 = coded_.next(); - // do asserts first if (e1 == 0) // end file 0's break; |