~ubuntu-branches/ubuntu/gutsy/openssl/gutsy-security

« back to all changes in this revision

Viewing changes to crypto/camellia/cmll_misc.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2007-03-10 17:11:46 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070310171146-ekahy2avht7qdc4f
Tags: 0.9.8e-4
openssl should depend on libssl0.9.8 0.9.8e-1 since it 
uses some of the defines that changed to functions.
Other things build against libssl or libcrypto shouldn't 
have this problem since they use the old headers.
(Closes: #414283)

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
#include <openssl/camellia.h>
54
54
#include "cmll_locl.h"
55
55
 
56
 
const char *CAMELLIA_version="CAMELLIA" OPENSSL_VERSION_PTEXT;
 
56
const char CAMELLIA_version[]="CAMELLIA" OPENSSL_VERSION_PTEXT;
57
57
 
58
58
int Camellia_set_key(const unsigned char *userKey, const int bits,
59
59
        CAMELLIA_KEY *key)
91
91
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
92
92
        const CAMELLIA_KEY *key)
93
93
        {
94
 
        uint32_t tmp[UNITSIZE];
 
94
        u32 tmp[CAMELLIA_BLOCK_SIZE/sizeof(u32)];
 
95
        const union { long one; char little; } camellia_endian = {1};
95
96
 
96
97
        memcpy(tmp, in, CAMELLIA_BLOCK_SIZE);
 
98
        if (camellia_endian.little) SWAP4WORD(tmp);
97
99
        key->enc(key->rd_key, tmp);
 
100
        if (camellia_endian.little) SWAP4WORD(tmp);
98
101
        memcpy(out, tmp, CAMELLIA_BLOCK_SIZE);
99
102
        }
100
103
 
101
104
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
102
105
        const CAMELLIA_KEY *key)
103
106
        {
104
 
        uint32_t tmp[UNITSIZE];
 
107
        u32 tmp[CAMELLIA_BLOCK_SIZE/sizeof(u32)];
 
108
        const union { long one; char little; } camellia_endian = {1};
105
109
 
106
110
        memcpy(tmp, in, CAMELLIA_BLOCK_SIZE);
 
111
        if (camellia_endian.little) SWAP4WORD(tmp);
107
112
        key->dec(key->rd_key, tmp);
 
113
        if (camellia_endian.little) SWAP4WORD(tmp);
108
114
        memcpy(out, tmp, CAMELLIA_BLOCK_SIZE);
109
115
        }
110
116