mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-15 02:44:20 -05:00
removed c style void* pointer-arithmetic with explicit cast
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2460 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
537eea5dbb
commit
6b3ab2996a
@ -1667,21 +1667,21 @@ bool AuthSSL::encrypt(void *&out, int &outlen, const void *in, int inlen, std
|
|||||||
/// ** copied implementation of EVP_SealInit of openssl V *** ///
|
/// ** copied implementation of EVP_SealInit of openssl V *** ///
|
||||||
|
|
||||||
net_ekl = htonl(ekl);
|
net_ekl = htonl(ekl);
|
||||||
memcpy((void*)(out + out_offset), (char*)&net_ekl, sizeof(net_ekl));
|
memcpy((void*)((uint8_t*)out)[out_offset], (char*)&net_ekl, sizeof(net_ekl));
|
||||||
out_offset += sizeof(net_ekl);
|
out_offset += sizeof(net_ekl);
|
||||||
|
|
||||||
memcpy((void*)(out + out_offset), ek, ekl);
|
memcpy((void*)((uint8_t*)out)[out_offset], ek, ekl);
|
||||||
out_offset += ekl;
|
out_offset += ekl;
|
||||||
|
|
||||||
memcpy((void*)(out + out_offset), iv, sizeof(iv));
|
memcpy((void*)((uint8_t*)out)[out_offset], iv, sizeof(iv));
|
||||||
out_offset += sizeof(iv);
|
out_offset += sizeof(iv);
|
||||||
|
|
||||||
EVP_EncryptUpdate(&cipher_ctx, cryptBuff, &cryptBuffL, (unsigned char*)in, inlen);
|
EVP_EncryptUpdate(&cipher_ctx, cryptBuff, &cryptBuffL, (unsigned char*)in, inlen);
|
||||||
memcpy((void*)(out + out_offset), cryptBuff, cryptBuffL);
|
memcpy((void*)((uint8_t*)out)[out_offset], cryptBuff, cryptBuffL);
|
||||||
out_offset += cryptBuffL;
|
out_offset += cryptBuffL;
|
||||||
|
|
||||||
EVP_EncryptFinal_ex(&cipher_ctx, cryptBuff, &cryptBuffL);
|
EVP_EncryptFinal_ex(&cipher_ctx, cryptBuff, &cryptBuffL);
|
||||||
memcpy((void*)(out + out_offset), cryptBuff, cryptBuffL);
|
memcpy((void*)((uint8_t*)out)[out_offset], cryptBuff, cryptBuffL);
|
||||||
out_offset += cryptBuffL;
|
out_offset += cryptBuffL;
|
||||||
|
|
||||||
outlen = out_offset;
|
outlen = out_offset;
|
||||||
@ -1724,7 +1724,7 @@ bool AuthSSL::decrypt(void *&out, int &outlen, const void *in, int inlen)
|
|||||||
unsigned int ekeylen;
|
unsigned int ekeylen;
|
||||||
|
|
||||||
|
|
||||||
memcpy(&ekeylen, (void*)(in + in_offset), sizeof(ekeylen));
|
memcpy(&ekeylen, (void*)((uint8_t*)in)[in_offset], sizeof(ekeylen));
|
||||||
in_offset += sizeof(ekeylen);
|
in_offset += sizeof(ekeylen);
|
||||||
|
|
||||||
ekeylen = ntohl(ekeylen);
|
ekeylen = ntohl(ekeylen);
|
||||||
@ -1737,10 +1737,10 @@ bool AuthSSL::decrypt(void *&out, int &outlen, const void *in, int inlen)
|
|||||||
|
|
||||||
encryptKey = new unsigned char [sizeof(char) * ekeylen];
|
encryptKey = new unsigned char [sizeof(char) * ekeylen];
|
||||||
|
|
||||||
memcpy(encryptKey, (void*)(in + in_offset), ekeylen);
|
memcpy(encryptKey, (void*)((uint8_t*)in)[in_offset], ekeylen);
|
||||||
in_offset += ekeylen;
|
in_offset += ekeylen;
|
||||||
|
|
||||||
memcpy(iv, (void*)(in + in_offset), sizeof(iv));
|
memcpy(iv, (void*)((uint8_t*)in)[in_offset], sizeof(iv));
|
||||||
in_offset += sizeof(iv);
|
in_offset += sizeof(iv);
|
||||||
|
|
||||||
// EVP_OpenInit(&ectx,
|
// EVP_OpenInit(&ectx,
|
||||||
@ -1779,7 +1779,7 @@ bool AuthSSL::decrypt(void *&out, int &outlen, const void *in, int inlen)
|
|||||||
/// ** copied implementation of EVP_SealInit of openssl V1.0 *** ///;
|
/// ** copied implementation of EVP_SealInit of openssl V1.0 *** ///;
|
||||||
|
|
||||||
|
|
||||||
if (!EVP_DecryptUpdate(&ectx, buf, &buflen, (unsigned char*)(in + in_offset), inlen - in_offset)) {
|
if (!EVP_DecryptUpdate(&ectx, buf, &buflen, (unsigned char*)((uint8_t*)in)[in_offset], inlen - in_offset)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memcpy(out, buf, buflen);
|
memcpy(out, buf, buflen);
|
||||||
@ -1788,7 +1788,7 @@ bool AuthSSL::decrypt(void *&out, int &outlen, const void *in, int inlen)
|
|||||||
if (!EVP_DecryptFinal(&ectx, buf, &buflen)) {
|
if (!EVP_DecryptFinal(&ectx, buf, &buflen)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memcpy((void*)(out + out_offset), buf, buflen);
|
memcpy((void*)((uint8_t*)out)[out_offset], buf, buflen);
|
||||||
out_offset += buflen;
|
out_offset += buflen;
|
||||||
outlen = out_offset;
|
outlen = out_offset;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user