mirror of
https://github.com/vgough/encfs.git
synced 2024-11-22 07:53:31 +01:00
Correct misc-misplaced-widening-cast clang warnings
This commit is contained in:
parent
e2ea0e4d2f
commit
1254c686ea
@ -179,7 +179,6 @@ if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.5) # Need 3.6 or abo
|
|||||||
",-google-readability-todo"
|
",-google-readability-todo"
|
||||||
",-google-runtime-int"
|
",-google-runtime-int"
|
||||||
",-google-runtime-references"
|
",-google-runtime-references"
|
||||||
",-misc-misplaced-widening-cast"
|
|
||||||
",-misc-unused-parameters"
|
",-misc-unused-parameters"
|
||||||
",-modernize-loop-convert"
|
",-modernize-loop-convert"
|
||||||
",-readability-inconsistent-declaration-parameter-name"
|
",-readability-inconsistent-declaration-parameter-name"
|
||||||
|
@ -251,7 +251,7 @@ ssize_t BlockFileIO::write(const IORequest &req) {
|
|||||||
unsigned char *inPtr = req.data;
|
unsigned char *inPtr = req.data;
|
||||||
while (size != 0u) {
|
while (size != 0u) {
|
||||||
blockReq.offset = blockNum * _blockSize;
|
blockReq.offset = blockNum * _blockSize;
|
||||||
int toCopy = min((size_t)(_blockSize - partialOffset), size);
|
size_t toCopy = min((size_t)_blockSize - (size_t)partialOffset, size);
|
||||||
|
|
||||||
// if writing an entire block, or writing a partial block that requires
|
// if writing an entire block, or writing a partial block that requires
|
||||||
// no merging with existing data..
|
// no merging with existing data..
|
||||||
|
@ -301,11 +301,11 @@ SSLKey::SSLKey(int keySize_, int ivLength_) {
|
|||||||
this->ivLength = ivLength_;
|
this->ivLength = ivLength_;
|
||||||
pthread_mutex_init(&mutex, nullptr);
|
pthread_mutex_init(&mutex, nullptr);
|
||||||
buffer = (unsigned char *)OPENSSL_malloc(keySize + ivLength);
|
buffer = (unsigned char *)OPENSSL_malloc(keySize + ivLength);
|
||||||
memset(buffer, 0, keySize + ivLength);
|
memset(buffer, 0, (size_t)keySize + (size_t)ivLength);
|
||||||
|
|
||||||
// most likely fails unless we're running as root, or a user-page-lock
|
// most likely fails unless we're running as root, or a user-page-lock
|
||||||
// kernel patch is applied..
|
// kernel patch is applied..
|
||||||
mlock(buffer, keySize + ivLength);
|
mlock(buffer, (size_t)keySize + (size_t)ivLength);
|
||||||
|
|
||||||
block_enc = EVP_CIPHER_CTX_new();
|
block_enc = EVP_CIPHER_CTX_new();
|
||||||
EVP_CIPHER_CTX_init(block_enc);
|
EVP_CIPHER_CTX_init(block_enc);
|
||||||
@ -320,10 +320,10 @@ SSLKey::SSLKey(int keySize_, int ivLength_) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSLKey::~SSLKey() {
|
SSLKey::~SSLKey() {
|
||||||
memset(buffer, 0, keySize + ivLength);
|
memset(buffer, 0, (size_t)keySize + (size_t)ivLength);
|
||||||
|
|
||||||
OPENSSL_free(buffer);
|
OPENSSL_free(buffer);
|
||||||
munlock(buffer, keySize + ivLength);
|
munlock(buffer, (size_t)keySize + (size_t)ivLength);
|
||||||
|
|
||||||
keySize = 0;
|
keySize = 0;
|
||||||
ivLength = 0;
|
ivLength = 0;
|
||||||
@ -593,7 +593,7 @@ CipherKey SSL_Cipher::readKey(const unsigned char *data,
|
|||||||
checksum = (checksum << 8) | (unsigned int)data[i];
|
checksum = (checksum << 8) | (unsigned int)data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tmpBuf, data + KEY_CHECKSUM_BYTES, _keySize + _ivLength);
|
memcpy(tmpBuf, data + KEY_CHECKSUM_BYTES, (size_t)_keySize + (size_t)_ivLength);
|
||||||
streamDecode(tmpBuf, _keySize + _ivLength, checksum, masterKey);
|
streamDecode(tmpBuf, _keySize + _ivLength, checksum, masterKey);
|
||||||
|
|
||||||
// check for success
|
// check for success
|
||||||
@ -608,7 +608,7 @@ CipherKey SSL_Cipher::readKey(const unsigned char *data,
|
|||||||
|
|
||||||
std::shared_ptr<SSLKey> key(new SSLKey(_keySize, _ivLength));
|
std::shared_ptr<SSLKey> key(new SSLKey(_keySize, _ivLength));
|
||||||
|
|
||||||
memcpy(key->buffer, tmpBuf, _keySize + _ivLength);
|
memcpy(key->buffer, tmpBuf, (size_t)_keySize + (size_t)_ivLength);
|
||||||
memset(tmpBuf, 0, sizeof(tmpBuf));
|
memset(tmpBuf, 0, sizeof(tmpBuf));
|
||||||
|
|
||||||
initKey(key, _blockCipher, _streamCipher, _keySize);
|
initKey(key, _blockCipher, _streamCipher, _keySize);
|
||||||
@ -652,7 +652,7 @@ bool SSL_Cipher::compareKey(const CipherKey &A, const CipherKey &B) const {
|
|||||||
rAssert(key1->keySize == _keySize);
|
rAssert(key1->keySize == _keySize);
|
||||||
rAssert(key2->keySize == _keySize);
|
rAssert(key2->keySize == _keySize);
|
||||||
|
|
||||||
return memcmp(key1->buffer, key2->buffer, _keySize + _ivLength) == 0;
|
return memcmp(key1->buffer, key2->buffer, (size_t)_keySize + (size_t)_ivLength) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SSL_Cipher::encodedKeySize() const {
|
int SSL_Cipher::encodedKeySize() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user