mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
- Made Camellia use uint32_t for 64-bit compatibility
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
#ifndef POLARSSL_CAMELLIA_H
|
||||
#define POLARSSL_CAMELLIA_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define CAMELLIA_ENCRYPT 1
|
||||
#define CAMELLIA_DECRYPT 0
|
||||
|
||||
@@ -29,7 +31,7 @@
|
||||
typedef struct
|
||||
{
|
||||
int nr; /*!< number of rounds */
|
||||
unsigned long rk[68]; /*!< CAMELLIA round keys */
|
||||
uint32_t rk[68]; /*!< CAMELLIA round keys */
|
||||
}
|
||||
camellia_context;
|
||||
|
||||
|
@@ -277,9 +277,9 @@ static const signed char transposes[2][20] =
|
||||
} \
|
||||
}
|
||||
|
||||
void camellia_feistel(unsigned long x[2], unsigned long k[2], unsigned long z[2])
|
||||
static void camellia_feistel(uint32_t x[2], uint32_t k[2], uint32_t z[2])
|
||||
{
|
||||
unsigned long I0, I1;
|
||||
uint32_t I0, I1;
|
||||
I0 = x[0] ^ k[0];
|
||||
I1 = x[1] ^ k[1];
|
||||
|
||||
@@ -307,11 +307,11 @@ void camellia_feistel(unsigned long x[2], unsigned long k[2], unsigned long z[2]
|
||||
void camellia_setkey_enc( camellia_context *ctx, unsigned char *key, int keysize )
|
||||
{
|
||||
int i, idx;
|
||||
unsigned long *RK;
|
||||
uint32_t *RK;
|
||||
unsigned char t[64];
|
||||
unsigned long SIGMA[6][2];
|
||||
unsigned long KC[16];
|
||||
unsigned long TK[20];
|
||||
uint32_t SIGMA[6][2];
|
||||
uint32_t KC[16];
|
||||
uint32_t TK[20];
|
||||
|
||||
RK = ctx->rk;
|
||||
|
||||
@@ -409,8 +409,8 @@ void camellia_setkey_dec( camellia_context *ctx, unsigned char *key, int keysize
|
||||
{
|
||||
int i, idx;
|
||||
camellia_context cty;
|
||||
unsigned long *RK;
|
||||
unsigned long *SK;
|
||||
uint32_t *RK;
|
||||
uint32_t *SK;
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
@@ -456,7 +456,7 @@ void camellia_crypt_ecb( camellia_context *ctx,
|
||||
unsigned char output[16] )
|
||||
{
|
||||
int NR;
|
||||
unsigned long *RK, X[4];
|
||||
uint32_t *RK, X[4];
|
||||
|
||||
NR = ctx->nr;
|
||||
RK = ctx->rk;
|
||||
|
Reference in New Issue
Block a user