Browse Source

Remove some unused bits of pnUtils.

Darryl Pogue 10 years ago
parent
commit
c0c9b03cce
  1. 76
      Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.cpp
  2. 27
      Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h
  3. 22
      Sources/Plasma/NucleusLib/pnUtils/pnUtList.h
  4. 1
      Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h

76
Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.cpp

@ -84,19 +84,6 @@ namespace Crypt {
* *
***/ ***/
//============================================================================
static void Rc4Codec (
CryptKey * key,
bool encrypt,
ARRAY(uint8_t) * dest,
unsigned sourceBytes,
const void * sourceData
) {
// RC4 uses the same algorithm to both encrypt and decrypt
dest->SetCount(sourceBytes);
RC4((RC4_KEY *)key->handle, sourceBytes, (const unsigned char *)sourceData, dest->Ptr());
}
//============================================================================ //============================================================================
static void Rc4Codec ( static void Rc4Codec (
CryptKey * key, CryptKey * key,
@ -158,52 +145,12 @@ void CryptKeyClose (
delete key; delete key;
} }
//============================================================================
unsigned CryptKeyGetBlockSize (
CryptKey * key
) {
switch (key->algorithm) {
case kCryptRc4: {
return 1;
}
break;
case kCryptRsa: // Not implemented; fall-thru to FATAL
// return RsaGetBlockSize(key);
DEFAULT_FATAL(algorithm);
}
}
//============================================================================
void CryptEncrypt (
CryptKey * key,
ARRAY(uint8_t) * dest,
unsigned sourceBytes,
const void * sourceData
) {
switch (key->algorithm) {
case kCryptRc4: {
Rc4Codec(key, true, dest, sourceBytes, sourceData);
}
break;
case kCryptRsa: // Not implemented; fall-thru to FATAL
// RsaCodec(key, true, dest, sourceBytes, sourceData);
// break;
DEFAULT_FATAL(key->algorithm);
}
}
//============================================================================ //============================================================================
void CryptEncrypt ( void CryptEncrypt (
CryptKey * key, CryptKey * key,
unsigned bytes, unsigned bytes,
void * data void * data
) { ) {
ASSERT(1 == CryptKeyGetBlockSize(key));
switch (key->algorithm) { switch (key->algorithm) {
case kCryptRc4: { case kCryptRc4: {
Rc4Codec(key, true, bytes, data); Rc4Codec(key, true, bytes, data);
@ -218,35 +165,12 @@ void CryptEncrypt (
} }
} }
//============================================================================
void CryptDecrypt (
CryptKey * key,
ARRAY(uint8_t) * dest,
unsigned sourceBytes,
const void * sourceData
) {
switch (key->algorithm) {
case kCryptRc4: {
Rc4Codec(key, false, dest, sourceBytes, sourceData);
}
break;
case kCryptRsa: // Not implemented; fall-thru to FATAL
// RsaCodec(key, false, dest, sourceBytes, sourceData);
// break;
DEFAULT_FATAL(key->algorithm);
}
}
//============================================================================ //============================================================================
void CryptDecrypt ( void CryptDecrypt (
CryptKey * key, CryptKey * key,
unsigned bytes, unsigned bytes,
void * data void * data
) { ) {
ASSERT(1 == CryptKeyGetBlockSize(key));
switch (key->algorithm) { switch (key->algorithm) {
case kCryptRc4: { case kCryptRc4: {
Rc4Codec(key, false, bytes, data); Rc4Codec(key, false, bytes, data);

27
Sources/Plasma/NucleusLib/pnUtils/pnUtCrypt.h

@ -83,45 +83,18 @@ void CryptKeyClose (
CryptKey * key CryptKey * key
); );
void CryptKeyGenerate (
ECryptAlgorithm algorithm,
unsigned keyBits, // used for algorithms with variable key strength
unsigned randomBytes,
const void * randomData,
ARRAY(uint8_t) * privateData,
ARRAY(uint8_t) * publicData // only for public key cryptography
);
unsigned CryptKeyGetBlockSize (
CryptKey * key
);
/***************************************************************************** /*****************************************************************************
* *
* Encryption and Decryption * Encryption and Decryption
* *
***/ ***/
void CryptEncrypt (
CryptKey * key,
ARRAY(uint8_t) * dest,
unsigned sourceBytes,
const void * sourceData
);
void CryptEncrypt ( void CryptEncrypt (
CryptKey * key, CryptKey * key,
unsigned bytes, unsigned bytes,
void * data void * data
); );
void CryptDecrypt (
CryptKey * key,
ARRAY(uint8_t) * dest, // padded out to the algorithm's block size
unsigned sourceBytes,
const void * sourceData
);
void CryptDecrypt ( void CryptDecrypt (
CryptKey * key, CryptKey * key,
unsigned bytes, unsigned bytes,

22
Sources/Plasma/NucleusLib/pnUtils/pnUtList.h

@ -74,7 +74,6 @@ enum ELinkType {
#define LINK(class) TLink< class > #define LINK(class) TLink< class >
#define LIST(class) TList< class > #define LIST(class) TList< class >
#define LISTDECL(class,field) TListDecl< class, offsetof(class,field) > #define LISTDECL(class,field) TListDecl< class, offsetof(class,field) >
#define LISTDYN(class) TListDyn< class >
/**************************************************************************** /****************************************************************************
@ -618,25 +617,4 @@ template<class T, int linkOffset>
TListDecl<T,linkOffset>::TListDecl () { TListDecl<T,linkOffset>::TListDecl () {
this->SetLinkOffset(linkOffset); this->SetLinkOffset(linkOffset);
} }
/****************************************************************************
*
* TListDyn
*
***/
template<class T>
class TListDyn : public TList<T> {
public:
void Initialize (int linkOffset);
};
//===========================================================================
template<class T>
void TListDyn<T>::Initialize (int linkOffset) {
this->SetLinkOffset(linkOffset);
}
#endif #endif

1
Sources/Plasma/NucleusLib/pnUtils/pnUtPriQ.h

@ -58,7 +58,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define PRIORITY_TIME(class) TPriorityTime< class > #define PRIORITY_TIME(class) TPriorityTime< class >
#define PRIQ(class,priority) TPriorityQueue< class,priority >
#define PRIQDECL(class,priority,field) TPriorityQueueDecl< class,priority,offsetof(class,field) > #define PRIQDECL(class,priority,field) TPriorityQueueDecl< class,priority,offsetof(class,field) >

Loading…
Cancel
Save