clean up some formatting issues w/ standard type PR, etc.
This commit is contained in:
parent
c9e32170ba
commit
15dfea4d85
|
@ -103,6 +103,7 @@ void cFCOSpecList::Add(iFCOSpec* pSpec, cFCOSpecAttr* pAttr)
|
||||||
pAttr = new cFCOSpecAttr;
|
pAttr = new cFCOSpecAttr;
|
||||||
else
|
else
|
||||||
pAttr->AddRef();
|
pAttr->AddRef();
|
||||||
|
|
||||||
for (itr = mCanonicalList.begin();; ++itr)
|
for (itr = mCanonicalList.begin();; ++itr)
|
||||||
{
|
{
|
||||||
if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first))
|
if (itr == mCanonicalList.end() || iFCOSpecUtil::FCOSpecLessThan(*pSpec, *itr->first))
|
||||||
|
@ -118,18 +119,22 @@ iFCOSpec* cFCOSpecList::Lookup(iFCOSpec* pSpec) const
|
||||||
{
|
{
|
||||||
std::list<PairType>::iterator itr;
|
std::list<PairType>::iterator itr;
|
||||||
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
|
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
|
||||||
|
{
|
||||||
if (itr->first == pSpec)
|
if (itr->first == pSpec)
|
||||||
{
|
{
|
||||||
pSpec->AddRef();
|
pSpec->AddRef();
|
||||||
return itr->first;
|
return itr->first;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
|
for (itr = mCanonicalList.begin(); itr != mCanonicalList.end(); ++itr)
|
||||||
|
{
|
||||||
if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first))
|
if (iFCOSpecUtil::FCOSpecEqual(*pSpec, *itr->first))
|
||||||
{
|
{
|
||||||
itr->first->AddRef();
|
itr->first->AddRef();
|
||||||
return itr->first;
|
return itr->first;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -141,11 +146,10 @@ void cFCOSpecList::Read(iSerializer* pSerializer, int32_t version)
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
int i;
|
|
||||||
int32_t size;
|
int32_t size;
|
||||||
pSerializer->ReadInt32(size);
|
pSerializer->ReadInt32(size);
|
||||||
|
|
||||||
for (i = 0; i < size; ++i)
|
for (int i = 0; i < size; ++i)
|
||||||
{
|
{
|
||||||
iFCOSpec* pReadInSpec = static_cast<iFCOSpec*>(pSerializer->ReadObjectDynCreate());
|
iFCOSpec* pReadInSpec = static_cast<iFCOSpec*>(pSerializer->ReadObjectDynCreate());
|
||||||
cFCOSpecAttr* pSpecAttr = static_cast<cFCOSpecAttr*>(pSerializer->ReadObjectDynCreate());
|
cFCOSpecAttr* pSpecAttr = static_cast<cFCOSpecAttr*>(pSerializer->ReadObjectDynCreate());
|
||||||
|
|
|
@ -343,7 +343,7 @@ void cKeyFile::WriteMem(int8_t* pMem) const // throw eKeyFile()
|
||||||
memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen);
|
memcpy(pMem, mpPrivateKeyMem, mPrivateKeyMemLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t cKeyFile::GetWriteLen() // throw eKeyFile()
|
int cKeyFile::GetWriteLen() // throw eKeyFile()
|
||||||
{
|
{
|
||||||
if (!KeysLoaded())
|
if (!KeysLoaded())
|
||||||
{
|
{
|
||||||
|
@ -359,7 +359,7 @@ int32_t cKeyFile::GetWriteLen() // throw eKeyFile()
|
||||||
mPrivateKeyMemLen; // the private key
|
mPrivateKeyMemLen; // the private key
|
||||||
}
|
}
|
||||||
|
|
||||||
void cKeyFile::ProtectKeys(int8_t* passphrase, int32_t passphraseLen) // throw eKeyFile()
|
void cKeyFile::ProtectKeys(int8_t* passphrase, int passphraseLen) // throw eKeyFile()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int16_t i16;
|
int16_t i16;
|
||||||
|
@ -470,7 +470,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
|
||||||
ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain());
|
ASSERT(des.GetBlockSizeCipher() == des.GetBlockSizePlain());
|
||||||
|
|
||||||
// get a copy of the ciphertext and decrypt it
|
// get a copy of the ciphertext and decrypt it
|
||||||
uint8_t* plainPrivateKeyMem = new uint8_t[mPrivateKeyMemLen];
|
int8_t* plainPrivateKeyMem = new int8_t[mPrivateKeyMemLen];
|
||||||
memcpy(plainPrivateKeyMem, mpPrivateKeyMem, mPrivateKeyMemLen);
|
memcpy(plainPrivateKeyMem, mpPrivateKeyMem, mPrivateKeyMemLen);
|
||||||
|
|
||||||
ASSERT(mPrivateKeyMemLen % des.GetBlockSizePlain() == 0);
|
ASSERT(mPrivateKeyMemLen % des.GetBlockSizePlain() == 0);
|
||||||
|
@ -486,7 +486,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
|
||||||
|
|
||||||
if (len + cHashedKey128::GetWriteLen() + sizeof(int16_t) > (unsigned int)mPrivateKeyMemLen)
|
if (len + cHashedKey128::GetWriteLen() + sizeof(int16_t) > (unsigned int)mPrivateKeyMemLen)
|
||||||
{
|
{
|
||||||
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen);
|
RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
|
||||||
delete [] plainPrivateKeyMem;
|
delete [] plainPrivateKeyMem;
|
||||||
RandomizeBytes(passphrase, passphraseLen);
|
RandomizeBytes(passphrase, passphraseLen);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -498,7 +498,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
|
||||||
if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0)
|
if (memcmp(plainPrivateKeyMem, privateHash.GetKey(), cHashedKey128::GetWriteLen()) != 0)
|
||||||
{
|
{
|
||||||
// passphrase didn't do the job
|
// passphrase didn't do the job
|
||||||
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen);
|
RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
|
||||||
delete [] plainPrivateKeyMem;
|
delete [] plainPrivateKeyMem;
|
||||||
RandomizeBytes(passphrase, passphraseLen);
|
RandomizeBytes(passphrase, passphraseLen);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -506,7 +506,7 @@ const cElGamalSigPrivateKey* cKeyFile::GetPrivateKey(int8_t* passphrase, int pas
|
||||||
|
|
||||||
mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t));
|
mpPrivateKey = new cElGamalSigPrivateKey(plainPrivateKeyMem + cHashedKey128::GetWriteLen() + sizeof(int16_t));
|
||||||
|
|
||||||
RandomizeBytes((int8_t*)plainPrivateKeyMem, mPrivateKeyMemLen);
|
RandomizeBytes(plainPrivateKeyMem, mPrivateKeyMemLen);
|
||||||
delete [] plainPrivateKeyMem;
|
delete [] plainPrivateKeyMem;
|
||||||
|
|
||||||
RandomizeBytes(passphrase, passphraseLen);
|
RandomizeBytes(passphrase, passphraseLen);
|
||||||
|
|
Loading…
Reference in New Issue