From 73bb4134264c003ccd36dbfca85442f258f933fd Mon Sep 17 00:00:00 2001 From: yutaka Date: Thu, 4 Oct 2007 09:34:34 +0000 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E3=82=8C=E5=BF=98=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@40 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- build/libraries/aes/ARM7/aes_util.c | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 build/libraries/aes/ARM7/aes_util.c diff --git a/build/libraries/aes/ARM7/aes_util.c b/build/libraries/aes/ARM7/aes_util.c new file mode 100644 index 00000000..47e82986 --- /dev/null +++ b/build/libraries/aes/ARM7/aes_util.c @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------* + Project: TwlIPL - libraries - aes + File: aes_util.c + + Copyright 2007 Nintendo. All rights reserved. + + These coded instructions, statements, and computer programs contain + proprietary information of Nintendo of America Inc. and/or Nintendo + Company Ltd., and are protected by Federal copyright law. They may + not be disclosed to third parties or copied or duplicated in any form, + in whole or in part, without the prior written consent of Nintendo. + + $Date:: $ + $Rev$ + $Author$ + *---------------------------------------------------------------------------*/ + +#include + +/*---------------------------------------------------------------------------* + Name: AESi_AddCounter + + Description: calculate updated counter + + Arguments: pCounter pointer to the counter at offset 0 + nums offset in blocks (AES_BLOCK_SIZE) + + Returns: None + *---------------------------------------------------------------------------*/ +void AESi_AddCounter(AESCounter* pCounter, u32 nums) +{ + u32 data = 0; + int i; + for (i = 0; i < 16; i++) + { + data += pCounter->bytes[i] + (nums & 0xFF); + pCounter->bytes[i] = (u8)(data & 0xFF); + data >>= 8; + nums >>= 8; + if ( !data && !nums ) + { + break; + } + } +} +