summaryrefslogtreecommitdiff
path: root/utils/nwztools/upgtools/mg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/nwztools/upgtools/mg.cpp')
-rw-r--r--utils/nwztools/upgtools/mg.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/utils/nwztools/upgtools/mg.cpp b/utils/nwztools/upgtools/mg.cpp
index 21659ff3cf..f02b67375a 100644
--- a/utils/nwztools/upgtools/mg.cpp
+++ b/utils/nwztools/upgtools/mg.cpp
@@ -28,24 +28,23 @@
28using namespace CryptoPP; 28using namespace CryptoPP;
29namespace 29namespace
30{ 30{
31 ECB_Mode< DES >::Decryption g_dec;
32 ECB_Mode< DES >::Encryption g_enc;
33
34 inline int dec_des_ecb(void *in, int size, void *out, uint8_t *key) 31 inline int dec_des_ecb(void *in, int size, void *out, uint8_t *key)
35 { 32 {
33 ECB_Mode< DES >::Decryption dec;
36 if(size % 8) 34 if(size % 8)
37 return 42; 35 return 42;
38 g_dec.SetKey(key, 8); 36 dec.SetKey(key, 8);
39 g_dec.ProcessData((byte*)out, (byte*)in, size); 37 dec.ProcessData((byte*)out, (byte*)in, size);
40 return 0; 38 return 0;
41 } 39 }
42 40
43 inline int enc_des_ecb(void *in, int size, void *out, uint8_t *key) 41 inline int enc_des_ecb(void *in, int size, void *out, uint8_t *key)
44 { 42 {
43 ECB_Mode< DES >::Encryption enc;
45 if(size % 8) 44 if(size % 8)
46 return 42; 45 return 42;
47 g_enc.SetKey(key, 8); 46 enc.SetKey(key, 8);
48 g_enc.ProcessData((byte*)out, (byte*)in, size); 47 enc.ProcessData((byte*)out, (byte*)in, size);
49 return 0; 48 return 0;
50 } 49 }
51} 50}