mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
Encrypt: remove unused functions detected by Cppcheck
This commit is contained in:
parent
d3fc504279
commit
8b244ce660
@ -816,16 +816,6 @@ void GetPrintNameFromXA(char *str, UINT size, X *x)
|
||||
|
||||
UniToStr(str, size, tmp);
|
||||
}
|
||||
void GetAllNameFromXEx(wchar_t *str, UINT size, X *x)
|
||||
{
|
||||
// Validate arguments
|
||||
if (x == NULL || str == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetAllNameFromNameEx(str, size, x->subject_name);
|
||||
}
|
||||
|
||||
// Get the display name from NAME
|
||||
void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name)
|
||||
@ -1178,29 +1168,6 @@ bool P12ToFileW(P12 *p12, wchar_t *filename)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Read a P12 from the file
|
||||
P12 *FileToP12W(wchar_t *filename)
|
||||
{
|
||||
BUF *b;
|
||||
P12 *p12;
|
||||
// Validate arguments
|
||||
if (filename == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
b = ReadDumpW(filename);
|
||||
if (b == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p12 = BufToP12(b);
|
||||
FreeBuf(b);
|
||||
|
||||
return p12;
|
||||
}
|
||||
|
||||
// Release of P12
|
||||
void FreeP12(P12 *p12)
|
||||
{
|
||||
@ -4022,41 +3989,6 @@ void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec)
|
||||
0);
|
||||
}
|
||||
|
||||
// Release the 3DES key
|
||||
void Des3FreeKey(DES_KEY *k)
|
||||
{
|
||||
// Validate arguments
|
||||
if (k == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DesFreeKeyValue(k->k1);
|
||||
DesFreeKeyValue(k->k2);
|
||||
DesFreeKeyValue(k->k3);
|
||||
|
||||
Free(k);
|
||||
}
|
||||
|
||||
// Create a 3DES key
|
||||
DES_KEY *Des3NewKey(void *k1, void *k2, void *k3)
|
||||
{
|
||||
DES_KEY *k;
|
||||
// Validate arguments
|
||||
if (k1 == NULL || k2 == NULL || k3 == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
k = ZeroMalloc(sizeof(DES_KEY));
|
||||
|
||||
k->k1 = DesNewKeyValue(k1);
|
||||
k->k2 = DesNewKeyValue(k2);
|
||||
k->k3 = DesNewKeyValue(k3);
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
// Create a new DES key element
|
||||
DES_KEY_VALUE *DesNewKeyValue(void *value)
|
||||
{
|
||||
@ -4078,16 +4010,6 @@ DES_KEY_VALUE *DesNewKeyValue(void *value)
|
||||
return v;
|
||||
}
|
||||
|
||||
// Random generation of new DES key element
|
||||
DES_KEY_VALUE *DesRandKeyValue()
|
||||
{
|
||||
UCHAR key_value[DES_KEY_SIZE];
|
||||
|
||||
DES_random_key((DES_cblock *)key_value);
|
||||
|
||||
return DesNewKeyValue(key_value);
|
||||
}
|
||||
|
||||
// Release of DES key element
|
||||
void DesFreeKeyValue(DES_KEY_VALUE *v)
|
||||
{
|
||||
@ -4309,58 +4231,6 @@ bool IsAesNiSupported()
|
||||
return supported;
|
||||
}
|
||||
|
||||
// Calculation of HMAC-SHA-1
|
||||
void MacSha1(void *dst, void *key, UINT key_size, void *data, UINT data_size)
|
||||
{
|
||||
UCHAR key_plus[SHA1_BLOCK_SIZE];
|
||||
UCHAR key_plus2[SHA1_BLOCK_SIZE];
|
||||
UCHAR key_plus5[SHA1_BLOCK_SIZE];
|
||||
UCHAR hash4[SHA1_HASH_SIZE];
|
||||
UINT i;
|
||||
BUF *buf3;
|
||||
BUF *buf6;
|
||||
// Validate arguments
|
||||
if (dst == NULL || key == NULL || data == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Zero(key_plus, sizeof(key_plus));
|
||||
if (key_size <= SHA1_BLOCK_SIZE)
|
||||
{
|
||||
Copy(key_plus, key, key_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
Sha1(key_plus, key, key_size);
|
||||
}
|
||||
|
||||
for (i = 0;i < sizeof(key_plus);i++)
|
||||
{
|
||||
key_plus2[i] = key_plus[i] ^ 0x36;
|
||||
}
|
||||
|
||||
buf3 = NewBuf();
|
||||
WriteBuf(buf3, key_plus2, sizeof(key_plus2));
|
||||
WriteBuf(buf3, data, data_size);
|
||||
|
||||
Sha1(hash4, buf3->Buf, buf3->Size);
|
||||
|
||||
for (i = 0;i < sizeof(key_plus);i++)
|
||||
{
|
||||
key_plus5[i] = key_plus[i] ^ 0x5c;
|
||||
}
|
||||
|
||||
buf6 = NewBuf();
|
||||
WriteBuf(buf6, key_plus5, sizeof(key_plus5));
|
||||
WriteBuf(buf6, hash4, sizeof(hash4));
|
||||
|
||||
Sha1(dst, buf6->Buf, buf6->Size);
|
||||
|
||||
FreeBuf(buf3);
|
||||
FreeBuf(buf6);
|
||||
}
|
||||
|
||||
// DH calculation
|
||||
bool DhCompute(DH_CTX *dh, void *dst_priv_key, void *src_pub_key, UINT key_size)
|
||||
{
|
||||
|
@ -452,7 +452,6 @@ BIO *P12ToBio(P12 *p12);
|
||||
BUF *P12ToBuf(P12 *p12);
|
||||
void FreePKCS12(PKCS12 *pkcs12);
|
||||
void FreeP12(P12 *p12);
|
||||
P12 *FileToP12W(wchar_t *filename);
|
||||
bool P12ToFileW(P12 *p12, wchar_t *filename);
|
||||
bool ParseP12(P12 *p12, X **x, K **k, char *password);
|
||||
bool IsEncryptedP12(P12 *p12);
|
||||
@ -466,7 +465,6 @@ void GetPrintNameFromName(wchar_t *str, UINT size, NAME *name);
|
||||
void GetAllNameFromX(wchar_t *str, UINT size, X *x);
|
||||
void GetAllNameFromName(wchar_t *str, UINT size, NAME *name);
|
||||
void GetAllNameFromNameEx(wchar_t *str, UINT size, NAME *name);
|
||||
void GetAllNameFromXEx(wchar_t *str, UINT size, X *x);
|
||||
BUF *BigNumToBuf(const BIGNUM *bn);
|
||||
BIGNUM *BinToBigNum(void *data, UINT size);
|
||||
X_SERIAL *CloneXSerial(X_SERIAL *src);
|
||||
@ -487,10 +485,7 @@ UINT RsaPublicSize(K *k);
|
||||
BUF *RsaPublicToBuf(K *k);
|
||||
|
||||
DES_KEY_VALUE *DesNewKeyValue(void *value);
|
||||
DES_KEY_VALUE *DesRandKeyValue();
|
||||
void DesFreeKeyValue(DES_KEY_VALUE *v);
|
||||
DES_KEY *Des3NewKey(void *k1, void *k2, void *k3);
|
||||
void Des3FreeKey(DES_KEY *k);
|
||||
void Des3Encrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec);
|
||||
void Des3Decrypt2(void *dest, void *src, UINT size, DES_KEY_VALUE *k1, DES_KEY_VALUE *k2, DES_KEY_VALUE *k3, void *ivec);
|
||||
void Sha(UINT sha_type, void *dst, void *src, UINT size);
|
||||
@ -500,7 +495,6 @@ void Sha2_384(void *dst, void *src, UINT size);
|
||||
void Sha2_512(void *dst, void *src, UINT size);
|
||||
|
||||
void Md5(void *dst, void *src, UINT size);
|
||||
void MacSha1(void *dst, void *key, UINT key_size, void *data, UINT data_size);
|
||||
void DesEncrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec);
|
||||
void DesDecrypt(void *dest, void *src, UINT size, DES_KEY_VALUE *k, void *ivec);
|
||||
void DesEcbEncrypt(void *dst, void *src, void *key_7bytes);
|
||||
|
Loading…
Reference in New Issue
Block a user