• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revisionff0c7c150e630254fec6dd2bcd36d306f6f759bf (tree)
Time2014-01-11 14:23:58
Authors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Change the algorithm to encrypt all settings.

Change Summary

Incremental Difference

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/registry.c
+++ b/registry.c
@@ -3189,55 +3189,33 @@ DWORD GetRandamDWRODValue(void)
31893189 void MaskSettingsData(const char* Salt, int SaltLength, void* Data, DWORD Size, int EscapeZero)
31903190 {
31913191 char Key[FMAX_PATH*2+1];
3192- ulong Hash[5];
3192+ BYTE* p;
31933193 DWORD i;
3194+ DWORD j;
3195+ ulong Hash[5];
31943196 BYTE Mask[20];
3195- BYTE* p;
31963197 memcpy(&Key[0], SecretKey, SecretKeyLength);
31973198 memcpy(&Key[SecretKeyLength], Salt, SaltLength);
3198- sha_memory(Key, SecretKeyLength + SaltLength, Hash);
3199- // sha.cはビッグエンディアンのため
3200- for(i = 0; i < 5; i++)
3201- Hash[i] = _byteswap_ulong(Hash[i]);
3202- memcpy(&Mask, &Hash, 20);
32033199 p = (BYTE*)Data;
32043200 for(i = 0; i < Size; i++)
32053201 {
3206- if(EscapeZero == YES)
3202+ if(i % 20 == 0)
32073203 {
3208- if(p[i] != 0 && p[i] != Mask[i % sizeof(Mask)])
3209- p[i] ^= Mask[i % sizeof(Mask)];
3204+ memcpy(&Key[SecretKeyLength + SaltLength], &i, 4);
3205+ sha_memory(Key, SecretKeyLength + SaltLength + 4, Hash);
3206+ // sha.cはビッグエンディアンのため
3207+ for(j = 0; j < 5; j++)
3208+ Hash[j] = _byteswap_ulong(Hash[j]);
3209+ memcpy(&Mask, &Hash, 20);
32103210 }
3211- else
3212- p[i] ^= Mask[i % sizeof(Mask)];
3211+ if(EscapeZero == NO || (p[i] != 0 && p[i] != Mask[i % 20]))
3212+ p[i] ^= Mask[i % 20];
32133213 }
32143214 }
32153215
32163216 void UnmaskSettingsData(const char* Salt, int SaltLength, void* Data, DWORD Size, int EscapeZero)
32173217 {
3218- char Key[FMAX_PATH*2+1];
3219- ulong Hash[5];
3220- DWORD i;
3221- BYTE Mask[20];
3222- BYTE* p;
3223- memcpy(&Key[0], SecretKey, SecretKeyLength);
3224- memcpy(&Key[SecretKeyLength], Salt, SaltLength);
3225- sha_memory(Key, SecretKeyLength + SaltLength, Hash);
3226- // sha.cはビッグエンディアンのため
3227- for(i = 0; i < 5; i++)
3228- Hash[i] = _byteswap_ulong(Hash[i]);
3229- memcpy(&Mask, &Hash, 20);
3230- p = (BYTE*)Data;
3231- for(i = 0; i < Size; i++)
3232- {
3233- if(EscapeZero == YES)
3234- {
3235- if(p[i] != 0 && p[i] != Mask[i % sizeof(Mask)])
3236- p[i] ^= Mask[i % sizeof(Mask)];
3237- }
3238- else
3239- p[i] ^= Mask[i % sizeof(Mask)];
3240- }
3218+ MaskSettingsData(Salt, SaltLength, Data, Size, EscapeZero);
32413219 }
32423220
32433221 void CalculateSettingsDataChecksum(void* Data, DWORD Size)