summaryrefslogtreecommitdiff
path: root/apps/plugins/keybox.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/keybox.c')
-rw-r--r--apps/plugins/keybox.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 570f4e6c76..8dc485ae9a 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -78,7 +78,7 @@ static void decrypt_buffer(char *buf, size_t size, uint32_t *key);
78 David Wheeler and Roger Needham taken from 78 David Wheeler and Roger Needham taken from
79 http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm */ 79 http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm */
80 80
81static void encrypt(uint32_t* v, uint32_t* k) 81static void do_encrypt(uint32_t* v, uint32_t* k)
82{ 82{
83 uint32_t v0=v[0], v1=v[1], sum=0, i; /* set up */ 83 uint32_t v0=v[0], v1=v[1], sum=0, i; /* set up */
84 static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ 84 static const uint32_t delta=0x9e3779b9; /* a key schedule constant */
@@ -91,7 +91,7 @@ static void encrypt(uint32_t* v, uint32_t* k)
91 v[0]=v0; v[1]=v1; 91 v[0]=v0; v[1]=v1;
92} 92}
93 93
94static void decrypt(uint32_t* v, uint32_t* k) 94static void do_decrypt(uint32_t* v, uint32_t* k)
95{ 95{
96 uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up */ 96 uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up */
97 static const uint32_t delta=0x9e3779b9; /* a key schedule constant */ 97 static const uint32_t delta=0x9e3779b9; /* a key schedule constant */
@@ -365,7 +365,7 @@ static void decrypt_buffer(char *buf, size_t size, uint32_t *key)
365 block[0] = letoh32(block[0]); 365 block[0] = letoh32(block[0]);
366 block[1] = letoh32(block[1]); 366 block[1] = letoh32(block[1]);
367 367
368 decrypt(&block[0], key); 368 do_decrypt(&block[0], key);
369 369
370 /* byte swap one block */ 370 /* byte swap one block */
371 block[0] = letoh32(block[0]); 371 block[0] = letoh32(block[0]);
@@ -388,7 +388,7 @@ static void encrypt_buffer(char *buf, size_t size, uint32_t *key)
388 block[0] = htole32(block[0]); 388 block[0] = htole32(block[0]);
389 block[1] = htole32(block[1]); 389 block[1] = htole32(block[1]);
390 390
391 encrypt(&block[0], key); 391 do_encrypt(&block[0], key);
392 392
393 block[0] = htole32(block[0]); 393 block[0] = htole32(block[0]);
394 block[1] = htole32(block[1]); 394 block[1] = htole32(block[1]);
@@ -670,4 +670,3 @@ enum plugin_status plugin_start(const void *parameter)
670 670
671 return PLUGIN_OK; 671 return PLUGIN_OK;
672} 672}
673