Compare commits
2 Commits
399a645a81
...
9da05dfb4f
Author | SHA1 | Date |
---|---|---|
Tomasz Sowa | 9da05dfb4f | |
Tomasz Sowa | deb8c31951 |
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012, Tomasz Sowa
|
||||
* Copyright (c) 2012-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -908,7 +908,7 @@ bool AES::DecodeCBC_PKCS7(std::vector<uint8> & content, const AES::uint8 * iv)
|
|||
if( !DecodeCBC(content.data(), content.size(), iv) )
|
||||
return false;
|
||||
|
||||
int pad = content[content.size()-1];
|
||||
size_t pad = content[content.size()-1];
|
||||
|
||||
if( pad > 16 || content.size() < pad )
|
||||
return false;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012, Tomasz Sowa
|
||||
* Copyright (c) 2012-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -36,10 +36,6 @@
|
|||
*/
|
||||
|
||||
#include "crypto.h"
|
||||
|
||||
// !! FIX ME
|
||||
//#include "log.h"
|
||||
|
||||
#include "utf8/utf8.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
@ -109,7 +105,7 @@ return true;
|
|||
|
||||
void Crypto::Crypt(const std::wstring & in, std::wstring & out)
|
||||
{
|
||||
PT::WideToUTF8(in, utf8_str);
|
||||
pt::wide_to_utf8(in, utf8_str);
|
||||
|
||||
if( utf8_str.empty() )
|
||||
aes.Encode(&dummy_char, 0, aes_name, uint8_tab);
|
||||
|
@ -172,7 +168,7 @@ bool Crypto::Decrypt(const std::wstring & in, std::wstring & out)
|
|||
if( aes.Decode((const unsigned char *)aes_str.c_str(), aes_str.size(), aes_tmp_name, uint8_tab) )
|
||||
{
|
||||
if( !uint8_tab.empty() )
|
||||
PT::UTF8ToWide((const char*)&uint8_tab[0], uint8_tab.size(), out);
|
||||
pt::utf8_to_wide((const char*)&uint8_tab[0], uint8_tab.size(), out);
|
||||
|
||||
Clear();
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue