~ubuntu-branches/ubuntu/wily/pianobar/wily-proposed

« back to all changes in this revision

Viewing changes to libpiano/src/crypt.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Faraone
  • Date: 2010-10-07 09:15:49 UTC
  • mfrom: (1.3.1 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101007091549-sscxdr1kud0d4hyl
Tags: 2010.10.07-1
* New upstream version. 
  - XMLRPC api version bump (v28) (closes: #599338)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <stdio.h>
26
26
#include <stdlib.h>
27
27
#include <stdint.h>
 
28
#include <arpa/inet.h>
28
29
 
29
30
#include "crypt_key_output.h"
30
31
#include "crypt_key_input.h"
35
36
                (((x) << 8) & 0x00ff0000) | \
36
37
                (((x) << 24) & 0xff000000))
37
38
 
 
39
#define hostToBigEndian32(x) htonl(x)
 
40
#define bigToHostEndian32(x) ntohl(x)
 
41
 
38
42
/*      decrypt hex-encoded, blowfish-crypted string: decode 2 hex-encoded blocks,
39
43
 *      decrypt, byteswap
40
44
 *      @param hex string
98
102
                        r ^= in_key_p [1];
99
103
                        l ^= in_key_p [0];
100
104
 
101
 
                        *(iDecrypt-2) = byteswap32 (l);
102
 
                        *(iDecrypt-1) = byteswap32 (r);
 
105
                        *(iDecrypt-2) = bigToHostEndian32 (l);
 
106
                        *(iDecrypt-1) = bigToHostEndian32 (r);
103
107
 
104
108
                        intsDecoded = 0;
105
109
                }
142
146
                register uint32_t l, r;
143
147
                int i;
144
148
 
145
 
                l = byteswap32 (*blockPtr);
146
 
                r = byteswap32 (*(blockPtr+1));
 
149
                l = hostToBigEndian32 (*blockPtr);
 
150
                r = hostToBigEndian32 (*(blockPtr+1));
147
151
                
148
152
                /* encrypt blocks */
149
153
                for (i = 0; i < out_key_n; i++) {