mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 16:38:38 +00:00
Same as previous commit with Camellia
This commit is contained in:
parent
afd5a08e33
commit
3ac6a2b9a7
1 changed files with 6 additions and 12 deletions
|
@ -435,20 +435,14 @@ int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
|
|||
uint32_t *SK;
|
||||
int ret;
|
||||
|
||||
switch( keysize )
|
||||
{
|
||||
case 128: ctx->nr = 3; idx = 0; break;
|
||||
case 192:
|
||||
case 256: ctx->nr = 4; idx = 1; break;
|
||||
default : return( POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH );
|
||||
}
|
||||
|
||||
RK = ctx->rk;
|
||||
|
||||
ret = camellia_setkey_enc(&cty, key, keysize);
|
||||
if( ret != 0 )
|
||||
/* Also checks keysize */
|
||||
if( ( ret = camellia_setkey_enc(&cty, key, keysize) ) )
|
||||
return( ret );
|
||||
|
||||
ctx->nr = cty.nr;
|
||||
idx = ( ctx->nr == 4 );
|
||||
|
||||
RK = ctx->rk;
|
||||
SK = cty.rk + 24 * 2 + 8 * idx * 2;
|
||||
|
||||
*RK++ = *SK++;
|
||||
|
|
Loading…
Reference in a new issue