mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-24 21:40:59 +00:00
- Made Camellia use uint32_t for 64-bit compatibility
This commit is contained in:
parent
0fdf3cacf2
commit
c81f6c3f06
|
@ -20,6 +20,8 @@
|
||||||
#ifndef POLARSSL_CAMELLIA_H
|
#ifndef POLARSSL_CAMELLIA_H
|
||||||
#define POLARSSL_CAMELLIA_H
|
#define POLARSSL_CAMELLIA_H
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#define CAMELLIA_ENCRYPT 1
|
#define CAMELLIA_ENCRYPT 1
|
||||||
#define CAMELLIA_DECRYPT 0
|
#define CAMELLIA_DECRYPT 0
|
||||||
|
|
||||||
|
@ -29,7 +31,7 @@
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int nr; /*!< number of rounds */
|
int nr; /*!< number of rounds */
|
||||||
unsigned long rk[68]; /*!< CAMELLIA round keys */
|
uint32_t rk[68]; /*!< CAMELLIA round keys */
|
||||||
}
|
}
|
||||||
camellia_context;
|
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];
|
I0 = x[0] ^ k[0];
|
||||||
I1 = x[1] ^ k[1];
|
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 )
|
void camellia_setkey_enc( camellia_context *ctx, unsigned char *key, int keysize )
|
||||||
{
|
{
|
||||||
int i, idx;
|
int i, idx;
|
||||||
unsigned long *RK;
|
uint32_t *RK;
|
||||||
unsigned char t[64];
|
unsigned char t[64];
|
||||||
unsigned long SIGMA[6][2];
|
uint32_t SIGMA[6][2];
|
||||||
unsigned long KC[16];
|
uint32_t KC[16];
|
||||||
unsigned long TK[20];
|
uint32_t TK[20];
|
||||||
|
|
||||||
RK = ctx->rk;
|
RK = ctx->rk;
|
||||||
|
|
||||||
|
@ -409,8 +409,8 @@ void camellia_setkey_dec( camellia_context *ctx, unsigned char *key, int keysize
|
||||||
{
|
{
|
||||||
int i, idx;
|
int i, idx;
|
||||||
camellia_context cty;
|
camellia_context cty;
|
||||||
unsigned long *RK;
|
uint32_t *RK;
|
||||||
unsigned long *SK;
|
uint32_t *SK;
|
||||||
|
|
||||||
switch( keysize )
|
switch( keysize )
|
||||||
{
|
{
|
||||||
|
@ -456,7 +456,7 @@ void camellia_crypt_ecb( camellia_context *ctx,
|
||||||
unsigned char output[16] )
|
unsigned char output[16] )
|
||||||
{
|
{
|
||||||
int NR;
|
int NR;
|
||||||
unsigned long *RK, X[4];
|
uint32_t *RK, X[4];
|
||||||
|
|
||||||
NR = ctx->nr;
|
NR = ctx->nr;
|
||||||
RK = ctx->rk;
|
RK = ctx->rk;
|
||||||
|
|
Loading…
Reference in a new issue