; generated by ARM C/C++ Compiler, 4.1 [Build 894]
; commandline ArmCC [--list --split_sections --debug -c --asm --interleave -o.\STM324xG_EVAL\stm32f4xx_cryp_aes.o --asm_dir=.\STM324xG_EVAL\ --list_dir=.\STM324xG_EVAL\ --depend=.\STM324xG_EVAL\stm32f4xx_cryp_aes.d --cpu=Cortex-M4.fp --apcs=interwork -O0 -Otime -I..\ -I..\..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\..\Utilities\STM32_EVAL\Common -I..\..\..\Utilities\STM32_EVAL\STM3240_41_G_EVAL -IC:\Keil\ARM\RV31\Inc -IC:\Keil\ARM\CMSIS\Include -IC:\Keil\ARM\Inc\ST\STM32F4xx -D__MICROLIB -DUSE_STM324xG_EVAL -DSTM32F4XX -DUSE_STDPERIPH_DRIVER --omf_browse=.\STM324xG_EVAL\stm32f4xx_cryp_aes.crf ..\..\..\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_cryp_aes.c]
                          THUMB

                          AREA ||i.CRYP_AES_CBC||, CODE, READONLY, ALIGN=1

                  CRYP_AES_CBC PROC
;;;278      */
;;;279    ErrorStatus CRYP_AES_CBC(uint8_t Mode, uint8_t InitVectors[16], uint8_t *Key,
000000  e92d4fff          PUSH     {r0-r11,lr}
;;;280                             uint16_t Keysize, uint8_t *Input, uint32_t Ilength,
;;;281                             uint8_t *Output)
;;;282    {
000004  ed2d8b02          VPUSH    {d8}
000008  b08f              SUB      sp,sp,#0x3c
00000a  4682              MOV      r10,r0
00000c  ed9d8a1e          VLDR     s16,[sp,#0x78]
000010  eddd8a20          VLDR     s17,[sp,#0x80]
;;;283      CRYP_InitTypeDef AES_CRYP_InitStructure;
;;;284      CRYP_KeyInitTypeDef AES_CRYP_KeyInitStructure;
;;;285      CRYP_IVInitTypeDef AES_CRYP_IVInitStructure;
;;;286      __IO uint32_t counter = 0;
000014  f04f0800          MOV      r8,#0
;;;287      uint32_t busystatus = 0;
000018  46c1              MOV      r9,r8
;;;288      ErrorStatus status = SUCCESS;
00001a  2001              MOVS     r0,#1
00001c  9000              STR      r0,[sp,#0]
;;;289      uint32_t keyaddr    = (uint32_t)Key;
00001e  ed9d0a13          VLDR     s0,[sp,#0x4c]
000022  ee104a10          VMOV     r4,s0
;;;290      uint32_t inputaddr  = (uint32_t)Input;
000026  ee185a10          VMOV     r5,s16
;;;291      uint32_t outputaddr = (uint32_t)Output;
00002a  ee186a90          VMOV     r6,s17
;;;292      uint32_t ivaddr     = (uint32_t)InitVectors;
00002e  ed9d0a12          VLDR     s0,[sp,#0x48]
000032  ee107a10          VMOV     r7,s0
;;;293      uint32_t i = 0;
000036  f04f0b00          MOV      r11,#0
;;;294    
;;;295      /* Crypto structures initialisation*/
;;;296      CRYP_KeyStructInit(&AES_CRYP_KeyInitStructure);
00003a  a805              ADD      r0,sp,#0x14
00003c  f7fffffe          BL       CRYP_KeyStructInit
;;;297    
;;;298      switch(Keysize)
000040  9814              LDR      r0,[sp,#0x50]
000042  2880              CMP      r0,#0x80
000044  d005              BEQ      |L1.82|
000046  28c0              CMP      r0,#0xc0
000048  d016              BEQ      |L1.120|
00004a  f5b07f80          CMP      r0,#0x100
00004e  d153              BNE      |L1.248|
000050  e02e              B        |L1.176|
                  |L1.82|
;;;299      {
;;;300        case 128:
;;;301        AES_CRYP_InitStructure.CRYP_KeySize = CRYP_KeySize_128b;
000052  2000              MOVS     r0,#0
000054  f8ad003a          STRH     r0,[sp,#0x3a]
;;;302        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
000058  6820              LDR      r0,[r4,#0]
00005a  ba00              REV      r0,r0
00005c  9009              STR      r0,[sp,#0x24]
;;;303        keyaddr+=4;
00005e  1d24              ADDS     r4,r4,#4
;;;304        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
000060  6820              LDR      r0,[r4,#0]
000062  ba00              REV      r0,r0
000064  900a              STR      r0,[sp,#0x28]
;;;305        keyaddr+=4;
000066  1d24              ADDS     r4,r4,#4
;;;306        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
000068  6820              LDR      r0,[r4,#0]
00006a  ba00              REV      r0,r0
00006c  900b              STR      r0,[sp,#0x2c]
;;;307        keyaddr+=4;
00006e  1d24              ADDS     r4,r4,#4
;;;308        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
000070  6820              LDR      r0,[r4,#0]
000072  ba00              REV      r0,r0
000074  900c              STR      r0,[sp,#0x30]
;;;309        break;
000076  e040              B        |L1.250|
                  |L1.120|
;;;310        case 192:
;;;311        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_192b;
000078  f44f7080          MOV      r0,#0x100
00007c  f8ad003a          STRH     r0,[sp,#0x3a]
;;;312        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
000080  6820              LDR      r0,[r4,#0]
000082  ba00              REV      r0,r0
000084  9007              STR      r0,[sp,#0x1c]
;;;313        keyaddr+=4;
000086  1d24              ADDS     r4,r4,#4
;;;314        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
000088  6820              LDR      r0,[r4,#0]
00008a  ba00              REV      r0,r0
00008c  9008              STR      r0,[sp,#0x20]
;;;315        keyaddr+=4;
00008e  1d24              ADDS     r4,r4,#4
;;;316        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
000090  6820              LDR      r0,[r4,#0]
000092  ba00              REV      r0,r0
000094  9009              STR      r0,[sp,#0x24]
;;;317        keyaddr+=4;
000096  1d24              ADDS     r4,r4,#4
;;;318        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
000098  6820              LDR      r0,[r4,#0]
00009a  ba00              REV      r0,r0
00009c  900a              STR      r0,[sp,#0x28]
;;;319        keyaddr+=4;
00009e  1d24              ADDS     r4,r4,#4
;;;320        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
0000a0  6820              LDR      r0,[r4,#0]
0000a2  ba00              REV      r0,r0
0000a4  900b              STR      r0,[sp,#0x2c]
;;;321        keyaddr+=4;
0000a6  1d24              ADDS     r4,r4,#4
;;;322        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
0000a8  6820              LDR      r0,[r4,#0]
0000aa  ba00              REV      r0,r0
0000ac  900c              STR      r0,[sp,#0x30]
;;;323        break;
0000ae  e024              B        |L1.250|
                  |L1.176|
;;;324        case 256:
;;;325        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_256b;
0000b0  f44f7000          MOV      r0,#0x200
0000b4  f8ad003a          STRH     r0,[sp,#0x3a]
;;;326        AES_CRYP_KeyInitStructure.CRYP_Key0Left = __REV(*(uint32_t*)(keyaddr));
0000b8  6820              LDR      r0,[r4,#0]
0000ba  ba00              REV      r0,r0
0000bc  9005              STR      r0,[sp,#0x14]
;;;327        keyaddr+=4;
0000be  1d24              ADDS     r4,r4,#4
;;;328        AES_CRYP_KeyInitStructure.CRYP_Key0Right= __REV(*(uint32_t*)(keyaddr));
0000c0  6820              LDR      r0,[r4,#0]
0000c2  ba00              REV      r0,r0
0000c4  9006              STR      r0,[sp,#0x18]
;;;329        keyaddr+=4;
0000c6  1d24              ADDS     r4,r4,#4
;;;330        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
0000c8  6820              LDR      r0,[r4,#0]
0000ca  ba00              REV      r0,r0
0000cc  9007              STR      r0,[sp,#0x1c]
;;;331        keyaddr+=4;
0000ce  1d24              ADDS     r4,r4,#4
;;;332        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
0000d0  6820              LDR      r0,[r4,#0]
0000d2  ba00              REV      r0,r0
0000d4  9008              STR      r0,[sp,#0x20]
;;;333        keyaddr+=4;
0000d6  1d24              ADDS     r4,r4,#4
;;;334        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
0000d8  6820              LDR      r0,[r4,#0]
0000da  ba00              REV      r0,r0
0000dc  9009              STR      r0,[sp,#0x24]
;;;335        keyaddr+=4;
0000de  1d24              ADDS     r4,r4,#4
;;;336        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
0000e0  6820              LDR      r0,[r4,#0]
0000e2  ba00              REV      r0,r0
0000e4  900a              STR      r0,[sp,#0x28]
;;;337        keyaddr+=4;
0000e6  1d24              ADDS     r4,r4,#4
;;;338        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
0000e8  6820              LDR      r0,[r4,#0]
0000ea  ba00              REV      r0,r0
0000ec  900b              STR      r0,[sp,#0x2c]
;;;339        keyaddr+=4;
0000ee  1d24              ADDS     r4,r4,#4
;;;340        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
0000f0  6820              LDR      r0,[r4,#0]
0000f2  ba00              REV      r0,r0
0000f4  900c              STR      r0,[sp,#0x30]
;;;341        break;
0000f6  e000              B        |L1.250|
                  |L1.248|
;;;342        default:
;;;343        break;
0000f8  bf00              NOP      
                  |L1.250|
0000fa  bf00              NOP                            ;309
;;;344      }
;;;345    
;;;346      /* CRYP Initialization Vectors */
;;;347      AES_CRYP_IVInitStructure.CRYP_IV0Left = __REV(*(uint32_t*)(ivaddr));
0000fc  6838              LDR      r0,[r7,#0]
0000fe  ba00              REV      r0,r0
000100  9001              STR      r0,[sp,#4]
;;;348      ivaddr+=4;
000102  1d3f              ADDS     r7,r7,#4
;;;349      AES_CRYP_IVInitStructure.CRYP_IV0Right= __REV(*(uint32_t*)(ivaddr));
000104  6838              LDR      r0,[r7,#0]
000106  ba00              REV      r0,r0
000108  9002              STR      r0,[sp,#8]
;;;350      ivaddr+=4;
00010a  1d3f              ADDS     r7,r7,#4
;;;351      AES_CRYP_IVInitStructure.CRYP_IV1Left = __REV(*(uint32_t*)(ivaddr));
00010c  6838              LDR      r0,[r7,#0]
00010e  ba00              REV      r0,r0
000110  9003              STR      r0,[sp,#0xc]
;;;352      ivaddr+=4;
000112  1d3f              ADDS     r7,r7,#4
;;;353      AES_CRYP_IVInitStructure.CRYP_IV1Right= __REV(*(uint32_t*)(ivaddr));
000114  6838              LDR      r0,[r7,#0]
000116  ba00              REV      r0,r0
000118  9004              STR      r0,[sp,#0x10]
;;;354    
;;;355    
;;;356      /*------------------ AES Decryption ------------------*/
;;;357      if(Mode == MODE_DECRYPT) /* AES decryption */
00011a  f1ba0f00          CMP      r10,#0
00011e  d12a              BNE      |L1.374|
;;;358      {
;;;359        /* Flush IN/OUT FIFOs */
;;;360        CRYP_FIFOFlush();
000120  f7fffffe          BL       CRYP_FIFOFlush
;;;361    
;;;362        /* Crypto Init for Key preparation for decryption process */
;;;363        AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Decrypt;
000124  2004              MOVS     r0,#4
000126  f8ad0034          STRH     r0,[sp,#0x34]
;;;364        AES_CRYP_InitStructure.CRYP_AlgoMode = CRYP_AlgoMode_AES_Key;
00012a  2038              MOVS     r0,#0x38
00012c  f8ad0036          STRH     r0,[sp,#0x36]
;;;365        AES_CRYP_InitStructure.CRYP_DataType = CRYP_DataType_32b;
000130  2000              MOVS     r0,#0
000132  f8ad0038          STRH     r0,[sp,#0x38]
;;;366    
;;;367        CRYP_Init(&AES_CRYP_InitStructure);
000136  a80d              ADD      r0,sp,#0x34
000138  f7fffffe          BL       CRYP_Init
;;;368    
;;;369        /* Key Initialisation */
;;;370        CRYP_KeyInit(&AES_CRYP_KeyInitStructure);
00013c  a805              ADD      r0,sp,#0x14
00013e  f7fffffe          BL       CRYP_KeyInit
;;;371    
;;;372        /* Enable Crypto processor */
;;;373        CRYP_Cmd(ENABLE);
000142  2001              MOVS     r0,#1
000144  f7fffffe          BL       CRYP_Cmd
;;;374    
;;;375        /* wait until the Busy flag is RESET */
;;;376        do
000148  bf00              NOP      
                  |L1.330|
;;;377        {
;;;378          busystatus = CRYP_GetFlagStatus(CRYP_FLAG_BUSY);
00014a  2010              MOVS     r0,#0x10
00014c  f7fffffe          BL       CRYP_GetFlagStatus
000150  4681              MOV      r9,r0
;;;379          counter++;
000152  f1080801          ADD      r8,r8,#1
;;;380        }while ((counter != AESBUSY_TIMEOUT) && (busystatus != RESET));
000156  f5b83f80          CMP      r8,#0x10000
00015a  d002              BEQ      |L1.354|
00015c  f1b90f00          CMP      r9,#0
000160  d1f3              BNE      |L1.330|
                  |L1.354|
;;;381    
;;;382        if (busystatus != RESET)
000162  f1b90f00          CMP      r9,#0
000166  d002              BEQ      |L1.366|
;;;383       {
;;;384           status = ERROR;
000168  2000              MOVS     r0,#0
00016a  9000              STR      r0,[sp,#0]
00016c  e009              B        |L1.386|
                  |L1.366|
;;;385        }
;;;386        else
;;;387        {
;;;388          /* Crypto Init for decryption process */  
;;;389          AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Decrypt;
00016e  2004              MOVS     r0,#4
000170  f8ad0034          STRH     r0,[sp,#0x34]
000174  e005              B        |L1.386|
                  |L1.374|
;;;390        }
;;;391      }
;;;392      /*------------------ AES Encryption ------------------*/
;;;393      else /* AES encryption */
;;;394      {
;;;395        CRYP_KeyInit(&AES_CRYP_KeyInitStructure);
000176  a805              ADD      r0,sp,#0x14
000178  f7fffffe          BL       CRYP_KeyInit
;;;396    
;;;397        /* Crypto Init for Encryption process */
;;;398        AES_CRYP_InitStructure.CRYP_AlgoDir  = CRYP_AlgoDir_Encrypt;
00017c  2000              MOVS     r0,#0
00017e  f8ad0034          STRH     r0,[sp,#0x34]
                  |L1.386|
;;;399      }
;;;400      AES_CRYP_InitStructure.CRYP_AlgoMode = CRYP_AlgoMode_AES_CBC;
000182  2028              MOVS     r0,#0x28
000184  f8ad0036          STRH     r0,[sp,#0x36]
;;;401      AES_CRYP_InitStructure.CRYP_DataType = CRYP_DataType_8b;
000188  2080              MOVS     r0,#0x80
00018a  f8ad0038          STRH     r0,[sp,#0x38]
;;;402      CRYP_Init(&AES_CRYP_InitStructure);
00018e  a80d              ADD      r0,sp,#0x34
000190  f7fffffe          BL       CRYP_Init
;;;403    
;;;404      /* CRYP Initialization Vectors */
;;;405      CRYP_IVInit(&AES_CRYP_IVInitStructure);
000194  a801              ADD      r0,sp,#4
000196  f7fffffe          BL       CRYP_IVInit
;;;406    
;;;407      /* Flush IN/OUT FIFOs */
;;;408      CRYP_FIFOFlush();
00019a  f7fffffe          BL       CRYP_FIFOFlush
;;;409    
;;;410      /* Enable Crypto processor */
;;;411      CRYP_Cmd(ENABLE);
00019e  2001              MOVS     r0,#1
0001a0  f7fffffe          BL       CRYP_Cmd
;;;412    
;;;413    
;;;414      for(i=0; ((i<Ilength) && (status != ERROR)); i+=16)
0001a4  f04f0b00          MOV      r11,#0
0001a8  e036              B        |L1.536|
                  |L1.426|
;;;415      {
;;;416    
;;;417        /* Write the Input block in the IN FIFO */
;;;418        CRYP_DataIn(*(uint32_t*)(inputaddr));
0001aa  6828              LDR      r0,[r5,#0]
0001ac  f7fffffe          BL       CRYP_DataIn
;;;419        inputaddr+=4;
0001b0  1d2d              ADDS     r5,r5,#4
;;;420        CRYP_DataIn(*(uint32_t*)(inputaddr));
0001b2  6828              LDR      r0,[r5,#0]
0001b4  f7fffffe          BL       CRYP_DataIn
;;;421        inputaddr+=4;
0001b8  1d2d              ADDS     r5,r5,#4
;;;422        CRYP_DataIn(*(uint32_t*)(inputaddr));
0001ba  6828              LDR      r0,[r5,#0]
0001bc  f7fffffe          BL       CRYP_DataIn
;;;423        inputaddr+=4;
0001c0  1d2d              ADDS     r5,r5,#4
;;;424        CRYP_DataIn(*(uint32_t*)(inputaddr));
0001c2  6828              LDR      r0,[r5,#0]
0001c4  f7fffffe          BL       CRYP_DataIn
;;;425        inputaddr+=4;
0001c8  1d2d              ADDS     r5,r5,#4
;;;426        /* Wait until the complete message has been processed */
;;;427        counter = 0;
0001ca  f04f0800          MOV      r8,#0
;;;428        do
0001ce  bf00              NOP      
                  |L1.464|
;;;429        {
;;;430          busystatus = CRYP_GetFlagStatus(CRYP_FLAG_BUSY);
0001d0  2010              MOVS     r0,#0x10
0001d2  f7fffffe          BL       CRYP_GetFlagStatus
0001d6  4681              MOV      r9,r0
;;;431          counter++;
0001d8  f1080801          ADD      r8,r8,#1
;;;432        }while ((counter != AESBUSY_TIMEOUT) && (busystatus != RESET));
0001dc  f5b83f80          CMP      r8,#0x10000
0001e0  d002              BEQ      |L1.488|
0001e2  f1b90f00          CMP      r9,#0
0001e6  d1f3              BNE      |L1.464|
                  |L1.488|
;;;433    
;;;434        if (busystatus != RESET)
0001e8  f1b90f00          CMP      r9,#0
0001ec  d002              BEQ      |L1.500|
;;;435       {
;;;436           status = ERROR;
0001ee  2000              MOVS     r0,#0
0001f0  9000              STR      r0,[sp,#0]
0001f2  e00f              B        |L1.532|
                  |L1.500|
;;;437        }
;;;438        else
;;;439        {
;;;440    
;;;441          /* Read the Output block from the Output FIFO */
;;;442          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001f4  f7fffffe          BL       CRYP_DataOut
0001f8  6030              STR      r0,[r6,#0]
;;;443          outputaddr+=4;
0001fa  1d36              ADDS     r6,r6,#4
;;;444          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001fc  f7fffffe          BL       CRYP_DataOut
000200  6030              STR      r0,[r6,#0]
;;;445          outputaddr+=4;
000202  1d36              ADDS     r6,r6,#4
;;;446          *(uint32_t*)(outputaddr) = CRYP_DataOut();
000204  f7fffffe          BL       CRYP_DataOut
000208  6030              STR      r0,[r6,#0]
;;;447          outputaddr+=4;
00020a  1d36              ADDS     r6,r6,#4
;;;448          *(uint32_t*)(outputaddr) = CRYP_DataOut();
00020c  f7fffffe          BL       CRYP_DataOut
000210  6030              STR      r0,[r6,#0]
;;;449          outputaddr+=4;
000212  1d36              ADDS     r6,r6,#4
                  |L1.532|
000214  f10b0b10          ADD      r11,r11,#0x10         ;414
                  |L1.536|
000218  981f              LDR      r0,[sp,#0x7c]         ;414
00021a  4583              CMP      r11,r0                ;414
00021c  d202              BCS      |L1.548|
00021e  9800              LDR      r0,[sp,#0]            ;414
000220  2800              CMP      r0,#0                 ;414
000222  d1c2              BNE      |L1.426|
                  |L1.548|
;;;450        }
;;;451      }
;;;452    
;;;453      /* Disable Crypto */
;;;454      CRYP_Cmd(DISABLE);
000224  2000              MOVS     r0,#0
000226  f7fffffe          BL       CRYP_Cmd
;;;455    
;;;456      return status;
00022a  9800              LDR      r0,[sp,#0]
;;;457    }
00022c  b00f              ADD      sp,sp,#0x3c
00022e  ecbd8b02          VPOP     {d8}
000232  b004              ADD      sp,sp,#0x10
000234  e8bd8ff0          POP      {r4-r11,pc}
;;;458    
                          ENDP


                          AREA ||i.CRYP_AES_CTR||, CODE, READONLY, ALIGN=1

                  CRYP_AES_CTR PROC
;;;474      */
;;;475    ErrorStatus CRYP_AES_CTR(uint8_t Mode, uint8_t InitVectors[16], uint8_t *Key, 
000000  e92d4ff0          PUSH     {r4-r11,lr}
;;;476                             uint16_t Keysize, uint8_t *Input, uint32_t Ilength,
;;;477                             uint8_t *Output)
;;;478    {
000004  ed2d8b02          VPUSH    {d8}
000008  b093              SUB      sp,sp,#0x4c
00000a  4680              MOV      r8,r0
00000c  4689              MOV      r9,r1
00000e  4692              MOV      r10,r2
000010  469b              MOV      r11,r3
000012  ed9d8a1e          VLDR     s16,[sp,#0x78]
000016  eddd8a20          VLDR     s17,[sp,#0x80]
;;;479      CRYP_InitTypeDef AES_CRYP_InitStructure;
;;;480      CRYP_KeyInitTypeDef AES_CRYP_KeyInitStructure;
;;;481      CRYP_IVInitTypeDef AES_CRYP_IVInitStructure;
;;;482      __IO uint32_t counter = 0;
00001a  2000              MOVS     r0,#0
00001c  9004              STR      r0,[sp,#0x10]
;;;483      uint32_t busystatus = 0;
00001e  9003              STR      r0,[sp,#0xc]
;;;484      ErrorStatus status = SUCCESS;
000020  2001              MOVS     r0,#1
000022  9002              STR      r0,[sp,#8]
;;;485      uint32_t keyaddr    = (uint32_t)Key;
000024  4654              MOV      r4,r10
;;;486      uint32_t inputaddr  = (uint32_t)Input;
000026  ee185a10          VMOV     r5,s16
;;;487      uint32_t outputaddr = (uint32_t)Output;
00002a  ee186a90          VMOV     r6,s17
;;;488      uint32_t ivaddr     = (uint32_t)InitVectors;
00002e  464f              MOV      r7,r9
;;;489      uint32_t i = 0;
000030  2000              MOVS     r0,#0
000032  9001              STR      r0,[sp,#4]
;;;490    
;;;491      /* Crypto structures initialisation*/
;;;492      CRYP_KeyStructInit(&AES_CRYP_KeyInitStructure);
000034  a809              ADD      r0,sp,#0x24
000036  f7fffffe          BL       CRYP_KeyStructInit
;;;493    
;;;494      switch(Keysize)
00003a  f1bb0f80          CMP      r11,#0x80
00003e  d006              BEQ      |L2.78|
000040  f1bb0fc0          CMP      r11,#0xc0
000044  d016              BEQ      |L2.116|
000046  f5bb7f80          CMP      r11,#0x100
00004a  d153              BNE      |L2.244|
00004c  e02e              B        |L2.172|
                  |L2.78|
;;;495      {
;;;496        case 128:
;;;497        AES_CRYP_InitStructure.CRYP_KeySize = CRYP_KeySize_128b;
00004e  2000              MOVS     r0,#0
000050  f8ad004a          STRH     r0,[sp,#0x4a]
;;;498        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
000054  6820              LDR      r0,[r4,#0]
000056  ba00              REV      r0,r0
000058  900d              STR      r0,[sp,#0x34]
;;;499        keyaddr+=4;
00005a  1d24              ADDS     r4,r4,#4
;;;500        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
00005c  6820              LDR      r0,[r4,#0]
00005e  ba00              REV      r0,r0
000060  900e              STR      r0,[sp,#0x38]
;;;501        keyaddr+=4;
000062  1d24              ADDS     r4,r4,#4
;;;502        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
000064  6820              LDR      r0,[r4,#0]
000066  ba00              REV      r0,r0
000068  900f              STR      r0,[sp,#0x3c]
;;;503        keyaddr+=4;
00006a  1d24              ADDS     r4,r4,#4
;;;504        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
00006c  6820              LDR      r0,[r4,#0]
00006e  ba00              REV      r0,r0
000070  9010              STR      r0,[sp,#0x40]
;;;505        break;
000072  e040              B        |L2.246|
                  |L2.116|
;;;506        case 192:
;;;507        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_192b;
000074  f44f7080          MOV      r0,#0x100
000078  f8ad004a          STRH     r0,[sp,#0x4a]
;;;508        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
00007c  6820              LDR      r0,[r4,#0]
00007e  ba00              REV      r0,r0
000080  900b              STR      r0,[sp,#0x2c]
;;;509        keyaddr+=4;
000082  1d24              ADDS     r4,r4,#4
;;;510        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
000084  6820              LDR      r0,[r4,#0]
000086  ba00              REV      r0,r0
000088  900c              STR      r0,[sp,#0x30]
;;;511        keyaddr+=4;
00008a  1d24              ADDS     r4,r4,#4
;;;512        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
00008c  6820              LDR      r0,[r4,#0]
00008e  ba00              REV      r0,r0
000090  900d              STR      r0,[sp,#0x34]
;;;513        keyaddr+=4;
000092  1d24              ADDS     r4,r4,#4
;;;514        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
000094  6820              LDR      r0,[r4,#0]
000096  ba00              REV      r0,r0
000098  900e              STR      r0,[sp,#0x38]
;;;515        keyaddr+=4;
00009a  1d24              ADDS     r4,r4,#4
;;;516        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
00009c  6820              LDR      r0,[r4,#0]
00009e  ba00              REV      r0,r0
0000a0  900f              STR      r0,[sp,#0x3c]
;;;517        keyaddr+=4;
0000a2  1d24              ADDS     r4,r4,#4
;;;518        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
0000a4  6820              LDR      r0,[r4,#0]
0000a6  ba00              REV      r0,r0
0000a8  9010              STR      r0,[sp,#0x40]
;;;519        break;
0000aa  e024              B        |L2.246|
                  |L2.172|
;;;520        case 256:
;;;521        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_256b;
0000ac  f44f7000          MOV      r0,#0x200
0000b0  f8ad004a          STRH     r0,[sp,#0x4a]
;;;522        AES_CRYP_KeyInitStructure.CRYP_Key0Left = __REV(*(uint32_t*)(keyaddr));
0000b4  6820              LDR      r0,[r4,#0]
0000b6  ba00              REV      r0,r0
0000b8  9009              STR      r0,[sp,#0x24]
;;;523        keyaddr+=4;
0000ba  1d24              ADDS     r4,r4,#4
;;;524        AES_CRYP_KeyInitStructure.CRYP_Key0Right= __REV(*(uint32_t*)(keyaddr));
0000bc  6820              LDR      r0,[r4,#0]
0000be  ba00              REV      r0,r0
0000c0  900a              STR      r0,[sp,#0x28]
;;;525        keyaddr+=4;
0000c2  1d24              ADDS     r4,r4,#4
;;;526        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
0000c4  6820              LDR      r0,[r4,#0]
0000c6  ba00              REV      r0,r0
0000c8  900b              STR      r0,[sp,#0x2c]
;;;527        keyaddr+=4;
0000ca  1d24              ADDS     r4,r4,#4
;;;528        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
0000cc  6820              LDR      r0,[r4,#0]
0000ce  ba00              REV      r0,r0
0000d0  900c              STR      r0,[sp,#0x30]
;;;529        keyaddr+=4;
0000d2  1d24              ADDS     r4,r4,#4
;;;530        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
0000d4  6820              LDR      r0,[r4,#0]
0000d6  ba00              REV      r0,r0
0000d8  900d              STR      r0,[sp,#0x34]
;;;531        keyaddr+=4;
0000da  1d24              ADDS     r4,r4,#4
;;;532        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
0000dc  6820              LDR      r0,[r4,#0]
0000de  ba00              REV      r0,r0
0000e0  900e              STR      r0,[sp,#0x38]
;;;533        keyaddr+=4;
0000e2  1d24              ADDS     r4,r4,#4
;;;534        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
0000e4  6820              LDR      r0,[r4,#0]
0000e6  ba00              REV      r0,r0
0000e8  900f              STR      r0,[sp,#0x3c]
;;;535        keyaddr+=4;
0000ea  1d24              ADDS     r4,r4,#4
;;;536        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
0000ec  6820              LDR      r0,[r4,#0]
0000ee  ba00              REV      r0,r0
0000f0  9010              STR      r0,[sp,#0x40]
;;;537        break;
0000f2  e000              B        |L2.246|
                  |L2.244|
;;;538        default:
;;;539        break;
0000f4  bf00              NOP      
                  |L2.246|
0000f6  bf00              NOP                            ;505
;;;540      }
;;;541      /* CRYP Initialization Vectors */
;;;542      AES_CRYP_IVInitStructure.CRYP_IV0Left = __REV(*(uint32_t*)(ivaddr));
0000f8  6838              LDR      r0,[r7,#0]
0000fa  ba00              REV      r0,r0
0000fc  9005              STR      r0,[sp,#0x14]
;;;543      ivaddr+=4;
0000fe  1d3f              ADDS     r7,r7,#4
;;;544      AES_CRYP_IVInitStructure.CRYP_IV0Right= __REV(*(uint32_t*)(ivaddr));
000100  6838              LDR      r0,[r7,#0]
000102  ba00              REV      r0,r0
000104  9006              STR      r0,[sp,#0x18]
;;;545      ivaddr+=4;
000106  1d3f              ADDS     r7,r7,#4
;;;546      AES_CRYP_IVInitStructure.CRYP_IV1Left = __REV(*(uint32_t*)(ivaddr));
000108  6838              LDR      r0,[r7,#0]
00010a  ba00              REV      r0,r0
00010c  9007              STR      r0,[sp,#0x1c]
;;;547      ivaddr+=4;
00010e  1d3f              ADDS     r7,r7,#4
;;;548      AES_CRYP_IVInitStructure.CRYP_IV1Right= __REV(*(uint32_t*)(ivaddr));
000110  6838              LDR      r0,[r7,#0]
000112  ba00              REV      r0,r0
000114  9008              STR      r0,[sp,#0x20]
;;;549    
;;;550      /* Key Initialisation */
;;;551      CRYP_KeyInit(&AES_CRYP_KeyInitStructure);
000116  a809              ADD      r0,sp,#0x24
000118  f7fffffe          BL       CRYP_KeyInit
;;;552    
;;;553      /*------------------ AES Decryption ------------------*/
;;;554      if(Mode == MODE_DECRYPT) /* AES decryption */
00011c  f1b80f00          CMP      r8,#0
000120  d103              BNE      |L2.298|
;;;555      {
;;;556        /* Crypto Init for decryption process */
;;;557        AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Decrypt;
000122  2004              MOVS     r0,#4
000124  f8ad0044          STRH     r0,[sp,#0x44]
000128  e002              B        |L2.304|
                  |L2.298|
;;;558      }
;;;559      /*------------------ AES Encryption ------------------*/
;;;560      else /* AES encryption */
;;;561      {
;;;562        /* Crypto Init for Encryption process */
;;;563        AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Encrypt;
00012a  2000              MOVS     r0,#0
00012c  f8ad0044          STRH     r0,[sp,#0x44]
                  |L2.304|
;;;564      }
;;;565      AES_CRYP_InitStructure.CRYP_AlgoMode = CRYP_AlgoMode_AES_CTR;
000130  2030              MOVS     r0,#0x30
000132  f8ad0046          STRH     r0,[sp,#0x46]
;;;566      AES_CRYP_InitStructure.CRYP_DataType = CRYP_DataType_8b;
000136  2080              MOVS     r0,#0x80
000138  f8ad0048          STRH     r0,[sp,#0x48]
;;;567      CRYP_Init(&AES_CRYP_InitStructure);
00013c  a811              ADD      r0,sp,#0x44
00013e  f7fffffe          BL       CRYP_Init
;;;568    
;;;569      /* CRYP Initialization Vectors */
;;;570      CRYP_IVInit(&AES_CRYP_IVInitStructure);
000142  a805              ADD      r0,sp,#0x14
000144  f7fffffe          BL       CRYP_IVInit
;;;571    
;;;572      /* Flush IN/OUT FIFOs */
;;;573      CRYP_FIFOFlush();
000148  f7fffffe          BL       CRYP_FIFOFlush
;;;574    
;;;575      /* Enable Crypto processor */
;;;576      CRYP_Cmd(ENABLE);
00014c  2001              MOVS     r0,#1
00014e  f7fffffe          BL       CRYP_Cmd
;;;577    
;;;578      for(i=0; ((i<Ilength) && (status != ERROR)); i+=16)
000152  2000              MOVS     r0,#0
000154  9001              STR      r0,[sp,#4]
000156  e038              B        |L2.458|
                  |L2.344|
;;;579      {
;;;580    
;;;581        /* Write the Input block in the IN FIFO */
;;;582        CRYP_DataIn(*(uint32_t*)(inputaddr));
000158  6828              LDR      r0,[r5,#0]
00015a  f7fffffe          BL       CRYP_DataIn
;;;583        inputaddr+=4;
00015e  1d2d              ADDS     r5,r5,#4
;;;584        CRYP_DataIn(*(uint32_t*)(inputaddr));
000160  6828              LDR      r0,[r5,#0]
000162  f7fffffe          BL       CRYP_DataIn
;;;585        inputaddr+=4;
000166  1d2d              ADDS     r5,r5,#4
;;;586        CRYP_DataIn(*(uint32_t*)(inputaddr));
000168  6828              LDR      r0,[r5,#0]
00016a  f7fffffe          BL       CRYP_DataIn
;;;587        inputaddr+=4;
00016e  1d2d              ADDS     r5,r5,#4
;;;588        CRYP_DataIn(*(uint32_t*)(inputaddr));
000170  6828              LDR      r0,[r5,#0]
000172  f7fffffe          BL       CRYP_DataIn
;;;589        inputaddr+=4;
000176  1d2d              ADDS     r5,r5,#4
;;;590        /* Wait until the complete message has been processed */
;;;591        counter = 0;
000178  2000              MOVS     r0,#0
00017a  9004              STR      r0,[sp,#0x10]
;;;592        do
00017c  bf00              NOP      
                  |L2.382|
;;;593        {
;;;594          busystatus = CRYP_GetFlagStatus(CRYP_FLAG_BUSY);
00017e  2010              MOVS     r0,#0x10
000180  f7fffffe          BL       CRYP_GetFlagStatus
000184  9003              STR      r0,[sp,#0xc]
;;;595          counter++;
000186  9804              LDR      r0,[sp,#0x10]
000188  1c40              ADDS     r0,r0,#1
00018a  9004              STR      r0,[sp,#0x10]
;;;596        }while ((counter != AESBUSY_TIMEOUT) && (busystatus != RESET));
00018c  9804              LDR      r0,[sp,#0x10]
00018e  f5b03f80          CMP      r0,#0x10000
000192  d002              BEQ      |L2.410|
000194  9803              LDR      r0,[sp,#0xc]
000196  2800              CMP      r0,#0
000198  d1f1              BNE      |L2.382|
                  |L2.410|
;;;597    
;;;598        if (busystatus != RESET)
00019a  9803              LDR      r0,[sp,#0xc]
00019c  b110              CBZ      r0,|L2.420|
;;;599       {
;;;600           status = ERROR;
00019e  2000              MOVS     r0,#0
0001a0  9002              STR      r0,[sp,#8]
0001a2  e00f              B        |L2.452|
                  |L2.420|
;;;601        }
;;;602        else
;;;603        {
;;;604    
;;;605          /* Read the Output block from the Output FIFO */
;;;606          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001a4  f7fffffe          BL       CRYP_DataOut
0001a8  6030              STR      r0,[r6,#0]
;;;607          outputaddr+=4;
0001aa  1d36              ADDS     r6,r6,#4
;;;608          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001ac  f7fffffe          BL       CRYP_DataOut
0001b0  6030              STR      r0,[r6,#0]
;;;609          outputaddr+=4;
0001b2  1d36              ADDS     r6,r6,#4
;;;610          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001b4  f7fffffe          BL       CRYP_DataOut
0001b8  6030              STR      r0,[r6,#0]
;;;611          outputaddr+=4;
0001ba  1d36              ADDS     r6,r6,#4
;;;612          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001bc  f7fffffe          BL       CRYP_DataOut
0001c0  6030              STR      r0,[r6,#0]
;;;613          outputaddr+=4;
0001c2  1d36              ADDS     r6,r6,#4
                  |L2.452|
0001c4  9801              LDR      r0,[sp,#4]            ;578
0001c6  3010              ADDS     r0,r0,#0x10           ;578
0001c8  9001              STR      r0,[sp,#4]            ;578
                  |L2.458|
0001ca  991f              LDR      r1,[sp,#0x7c]         ;578
0001cc  9801              LDR      r0,[sp,#4]            ;578
0001ce  4288              CMP      r0,r1                 ;578
0001d0  d202              BCS      |L2.472|
0001d2  9802              LDR      r0,[sp,#8]            ;578
0001d4  2800              CMP      r0,#0                 ;578
0001d6  d1bf              BNE      |L2.344|
                  |L2.472|
;;;614        }
;;;615      }
;;;616      /* Disable Crypto */
;;;617      CRYP_Cmd(DISABLE);
0001d8  2000              MOVS     r0,#0
0001da  f7fffffe          BL       CRYP_Cmd
;;;618    
;;;619      return status;
0001de  9802              LDR      r0,[sp,#8]
;;;620    }
0001e0  b013              ADD      sp,sp,#0x4c
0001e2  ecbd8b02          VPOP     {d8}
0001e6  e8bd8ff0          POP      {r4-r11,pc}
;;;621    /**
                          ENDP


                          AREA ||i.CRYP_AES_ECB||, CODE, READONLY, ALIGN=1

                  CRYP_AES_ECB PROC
;;;97       */
;;;98     ErrorStatus CRYP_AES_ECB(uint8_t Mode, uint8_t* Key, uint16_t Keysize,
000000  e92d4fff          PUSH     {r0-r11,lr}
;;;99                              uint8_t* Input, uint32_t Ilength, uint8_t* Output)
;;;100    {
000004  ed2d8b02          VPUSH    {d8}
000008  b08d              SUB      sp,sp,#0x34
00000a  4681              MOV      r9,r0
00000c  468a              MOV      r10,r1
00000e  4693              MOV      r11,r2
000010  ed9d8a1d          VLDR     s16,[sp,#0x74]
;;;101      CRYP_InitTypeDef AES_CRYP_InitStructure;
;;;102      CRYP_KeyInitTypeDef AES_CRYP_KeyInitStructure;
;;;103      __IO uint32_t counter = 0;
000014  2700              MOVS     r7,#0
;;;104      uint32_t busystatus = 0;
000016  46b8              MOV      r8,r7
;;;105      ErrorStatus status = SUCCESS;
000018  2001              MOVS     r0,#1
00001a  9002              STR      r0,[sp,#8]
;;;106      uint32_t keyaddr    = (uint32_t)Key;
00001c  4654              MOV      r4,r10
;;;107      uint32_t inputaddr  = (uint32_t)Input;
00001e  ed9d0a12          VLDR     s0,[sp,#0x48]
000022  ee105a10          VMOV     r5,s0
;;;108      uint32_t outputaddr = (uint32_t)Output;
000026  ee186a10          VMOV     r6,s16
;;;109      uint32_t i = 0;
00002a  2000              MOVS     r0,#0
00002c  9001              STR      r0,[sp,#4]
;;;110    
;;;111      /* Crypto structures initialisation*/
;;;112      CRYP_KeyStructInit(&AES_CRYP_KeyInitStructure);
00002e  a803              ADD      r0,sp,#0xc
000030  f7fffffe          BL       CRYP_KeyStructInit
;;;113    
;;;114      switch(Keysize)
000034  f1bb0f80          CMP      r11,#0x80
000038  d006              BEQ      |L3.72|
00003a  f1bb0fc0          CMP      r11,#0xc0
00003e  d016              BEQ      |L3.110|
000040  f5bb7f80          CMP      r11,#0x100
000044  d153              BNE      |L3.238|
000046  e02e              B        |L3.166|
                  |L3.72|
;;;115      {
;;;116        case 128:
;;;117        AES_CRYP_InitStructure.CRYP_KeySize = CRYP_KeySize_128b;
000048  2000              MOVS     r0,#0
00004a  f8ad0032          STRH     r0,[sp,#0x32]
;;;118        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
00004e  6820              LDR      r0,[r4,#0]
000050  ba00              REV      r0,r0
000052  9007              STR      r0,[sp,#0x1c]
;;;119        keyaddr+=4;
000054  1d24              ADDS     r4,r4,#4
;;;120        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
000056  6820              LDR      r0,[r4,#0]
000058  ba00              REV      r0,r0
00005a  9008              STR      r0,[sp,#0x20]
;;;121        keyaddr+=4;
00005c  1d24              ADDS     r4,r4,#4
;;;122        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
00005e  6820              LDR      r0,[r4,#0]
000060  ba00              REV      r0,r0
000062  9009              STR      r0,[sp,#0x24]
;;;123        keyaddr+=4;
000064  1d24              ADDS     r4,r4,#4
;;;124        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
000066  6820              LDR      r0,[r4,#0]
000068  ba00              REV      r0,r0
00006a  900a              STR      r0,[sp,#0x28]
;;;125        break;
00006c  e040              B        |L3.240|
                  |L3.110|
;;;126        case 192:
;;;127        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_192b;
00006e  f44f7080          MOV      r0,#0x100
000072  f8ad0032          STRH     r0,[sp,#0x32]
;;;128        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
000076  6820              LDR      r0,[r4,#0]
000078  ba00              REV      r0,r0
00007a  9005              STR      r0,[sp,#0x14]
;;;129        keyaddr+=4;
00007c  1d24              ADDS     r4,r4,#4
;;;130        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
00007e  6820              LDR      r0,[r4,#0]
000080  ba00              REV      r0,r0
000082  9006              STR      r0,[sp,#0x18]
;;;131        keyaddr+=4;
000084  1d24              ADDS     r4,r4,#4
;;;132        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
000086  6820              LDR      r0,[r4,#0]
000088  ba00              REV      r0,r0
00008a  9007              STR      r0,[sp,#0x1c]
;;;133        keyaddr+=4;
00008c  1d24              ADDS     r4,r4,#4
;;;134        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
00008e  6820              LDR      r0,[r4,#0]
000090  ba00              REV      r0,r0
000092  9008              STR      r0,[sp,#0x20]
;;;135        keyaddr+=4;
000094  1d24              ADDS     r4,r4,#4
;;;136        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
000096  6820              LDR      r0,[r4,#0]
000098  ba00              REV      r0,r0
00009a  9009              STR      r0,[sp,#0x24]
;;;137        keyaddr+=4;
00009c  1d24              ADDS     r4,r4,#4
;;;138        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
00009e  6820              LDR      r0,[r4,#0]
0000a0  ba00              REV      r0,r0
0000a2  900a              STR      r0,[sp,#0x28]
;;;139        break;
0000a4  e024              B        |L3.240|
                  |L3.166|
;;;140        case 256:
;;;141        AES_CRYP_InitStructure.CRYP_KeySize  = CRYP_KeySize_256b;
0000a6  f44f7000          MOV      r0,#0x200
0000aa  f8ad0032          STRH     r0,[sp,#0x32]
;;;142        AES_CRYP_KeyInitStructure.CRYP_Key0Left = __REV(*(uint32_t*)(keyaddr));
0000ae  6820              LDR      r0,[r4,#0]
0000b0  ba00              REV      r0,r0
0000b2  9003              STR      r0,[sp,#0xc]
;;;143        keyaddr+=4;
0000b4  1d24              ADDS     r4,r4,#4
;;;144        AES_CRYP_KeyInitStructure.CRYP_Key0Right= __REV(*(uint32_t*)(keyaddr));
0000b6  6820              LDR      r0,[r4,#0]
0000b8  ba00              REV      r0,r0
0000ba  9004              STR      r0,[sp,#0x10]
;;;145        keyaddr+=4;
0000bc  1d24              ADDS     r4,r4,#4
;;;146        AES_CRYP_KeyInitStructure.CRYP_Key1Left = __REV(*(uint32_t*)(keyaddr));
0000be  6820              LDR      r0,[r4,#0]
0000c0  ba00              REV      r0,r0
0000c2  9005              STR      r0,[sp,#0x14]
;;;147        keyaddr+=4;
0000c4  1d24              ADDS     r4,r4,#4
;;;148        AES_CRYP_KeyInitStructure.CRYP_Key1Right= __REV(*(uint32_t*)(keyaddr));
0000c6  6820              LDR      r0,[r4,#0]
0000c8  ba00              REV      r0,r0
0000ca  9006              STR      r0,[sp,#0x18]
;;;149        keyaddr+=4;
0000cc  1d24              ADDS     r4,r4,#4
;;;150        AES_CRYP_KeyInitStructure.CRYP_Key2Left = __REV(*(uint32_t*)(keyaddr));
0000ce  6820              LDR      r0,[r4,#0]
0000d0  ba00              REV      r0,r0
0000d2  9007              STR      r0,[sp,#0x1c]
;;;151        keyaddr+=4;
0000d4  1d24              ADDS     r4,r4,#4
;;;152        AES_CRYP_KeyInitStructure.CRYP_Key2Right= __REV(*(uint32_t*)(keyaddr));
0000d6  6820              LDR      r0,[r4,#0]
0000d8  ba00              REV      r0,r0
0000da  9008              STR      r0,[sp,#0x20]
;;;153        keyaddr+=4;
0000dc  1d24              ADDS     r4,r4,#4
;;;154        AES_CRYP_KeyInitStructure.CRYP_Key3Left = __REV(*(uint32_t*)(keyaddr));
0000de  6820              LDR      r0,[r4,#0]
0000e0  ba00              REV      r0,r0
0000e2  9009              STR      r0,[sp,#0x24]
;;;155        keyaddr+=4;
0000e4  1d24              ADDS     r4,r4,#4
;;;156        AES_CRYP_KeyInitStructure.CRYP_Key3Right= __REV(*(uint32_t*)(keyaddr));
0000e6  6820              LDR      r0,[r4,#0]
0000e8  ba00              REV      r0,r0
0000ea  900a              STR      r0,[sp,#0x28]
;;;157        break;
0000ec  e000              B        |L3.240|
                  |L3.238|
;;;158        default:
;;;159        break;
0000ee  bf00              NOP      
                  |L3.240|
0000f0  bf00              NOP                            ;125
;;;160      }
;;;161    
;;;162      /*------------------ AES Decryption ------------------*/
;;;163      if(Mode == MODE_DECRYPT) /* AES decryption */
0000f2  f1b90f00          CMP      r9,#0
0000f6  d129              BNE      |L3.332|
;;;164      {
;;;165        /* Flush IN/OUT FIFOs */
;;;166        CRYP_FIFOFlush();
0000f8  f7fffffe          BL       CRYP_FIFOFlush
;;;167    
;;;168        /* Crypto Init for Key preparation for decryption process */
;;;169        AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Decrypt;
0000fc  2004              MOVS     r0,#4
0000fe  f8ad002c          STRH     r0,[sp,#0x2c]
;;;170        AES_CRYP_InitStructure.CRYP_AlgoMode = CRYP_AlgoMode_AES_Key;
000102  2038              MOVS     r0,#0x38
000104  f8ad002e          STRH     r0,[sp,#0x2e]
;;;171        AES_CRYP_InitStructure.CRYP_DataType = CRYP_DataType_32b;
000108  2000              MOVS     r0,#0
00010a  f8ad0030          STRH     r0,[sp,#0x30]
;;;172        CRYP_Init(&AES_CRYP_InitStructure);
00010e  a80b              ADD      r0,sp,#0x2c
000110  f7fffffe          BL       CRYP_Init
;;;173    
;;;174        /* Key Initialisation */
;;;175        CRYP_KeyInit(&AES_CRYP_KeyInitStructure);
000114  a803              ADD      r0,sp,#0xc
000116  f7fffffe          BL       CRYP_KeyInit
;;;176    
;;;177        /* Enable Crypto processor */
;;;178        CRYP_Cmd(ENABLE);
00011a  2001              MOVS     r0,#1
00011c  f7fffffe          BL       CRYP_Cmd
;;;179    
;;;180        /* wait until the Busy flag is RESET */
;;;181        do
000120  bf00              NOP      
                  |L3.290|
;;;182        {
;;;183          busystatus = CRYP_GetFlagStatus(CRYP_FLAG_BUSY);
000122  2010              MOVS     r0,#0x10
000124  f7fffffe          BL       CRYP_GetFlagStatus
000128  4680              MOV      r8,r0
;;;184          counter++;
00012a  1c7f              ADDS     r7,r7,#1
;;;185        }while ((counter != AESBUSY_TIMEOUT) && (busystatus != RESET));
00012c  f5b73f80          CMP      r7,#0x10000
000130  d002              BEQ      |L3.312|
000132  f1b80f00          CMP      r8,#0
000136  d1f4              BNE      |L3.290|
                  |L3.312|
;;;186    
;;;187        if (busystatus != RESET)
000138  f1b80f00          CMP      r8,#0
00013c  d002              BEQ      |L3.324|
;;;188       {
;;;189           status = ERROR;
00013e  2000              MOVS     r0,#0
000140  9002              STR      r0,[sp,#8]
000142  e009              B        |L3.344|
                  |L3.324|
;;;190        }
;;;191        else
;;;192        {
;;;193          /* Crypto Init for decryption process */  
;;;194          AES_CRYP_InitStructure.CRYP_AlgoDir = CRYP_AlgoDir_Decrypt;
000144  2004              MOVS     r0,#4
000146  f8ad002c          STRH     r0,[sp,#0x2c]
00014a  e005              B        |L3.344|
                  |L3.332|
;;;195        }
;;;196      }
;;;197      /*------------------ AES Encryption ------------------*/
;;;198      else /* AES encryption */
;;;199      {
;;;200    
;;;201        CRYP_KeyInit(&AES_CRYP_KeyInitStructure);
00014c  a803              ADD      r0,sp,#0xc
00014e  f7fffffe          BL       CRYP_KeyInit
;;;202    
;;;203        /* Crypto Init for Encryption process */
;;;204        AES_CRYP_InitStructure.CRYP_AlgoDir  = CRYP_AlgoDir_Encrypt;
000152  2000              MOVS     r0,#0
000154  f8ad002c          STRH     r0,[sp,#0x2c]
                  |L3.344|
;;;205      }
;;;206    
;;;207      AES_CRYP_InitStructure.CRYP_AlgoMode = CRYP_AlgoMode_AES_ECB;
000158  2020              MOVS     r0,#0x20
00015a  f8ad002e          STRH     r0,[sp,#0x2e]
;;;208      AES_CRYP_InitStructure.CRYP_DataType = CRYP_DataType_8b;
00015e  2080              MOVS     r0,#0x80
000160  f8ad0030          STRH     r0,[sp,#0x30]
;;;209      CRYP_Init(&AES_CRYP_InitStructure);
000164  a80b              ADD      r0,sp,#0x2c
000166  f7fffffe          BL       CRYP_Init
;;;210    
;;;211      /* Flush IN/OUT FIFOs */
;;;212      CRYP_FIFOFlush();
00016a  f7fffffe          BL       CRYP_FIFOFlush
;;;213    
;;;214      /* Enable Crypto processor */
;;;215      CRYP_Cmd(ENABLE);
00016e  2001              MOVS     r0,#1
000170  f7fffffe          BL       CRYP_Cmd
;;;216    
;;;217      for(i=0; ((i<Ilength) && (status != ERROR)); i+=16)
000174  2000              MOVS     r0,#0
000176  9001              STR      r0,[sp,#4]
000178  e035              B        |L3.486|
                  |L3.378|
;;;218      {
;;;219    
;;;220        /* Write the Input block in the IN FIFO */
;;;221        CRYP_DataIn(*(uint32_t*)(inputaddr));
00017a  6828              LDR      r0,[r5,#0]
00017c  f7fffffe          BL       CRYP_DataIn
;;;222        inputaddr+=4;
000180  1d2d              ADDS     r5,r5,#4
;;;223        CRYP_DataIn(*(uint32_t*)(inputaddr));
000182  6828              LDR      r0,[r5,#0]
000184  f7fffffe          BL       CRYP_DataIn
;;;224        inputaddr+=4;
000188  1d2d              ADDS     r5,r5,#4
;;;225        CRYP_DataIn(*(uint32_t*)(inputaddr));
00018a  6828              LDR      r0,[r5,#0]
00018c  f7fffffe          BL       CRYP_DataIn
;;;226        inputaddr+=4;
000190  1d2d              ADDS     r5,r5,#4
;;;227        CRYP_DataIn(*(uint32_t*)(inputaddr));
000192  6828              LDR      r0,[r5,#0]
000194  f7fffffe          BL       CRYP_DataIn
;;;228        inputaddr+=4;
000198  1d2d              ADDS     r5,r5,#4
;;;229    
;;;230        /* Wait until the complete message has been processed */
;;;231        counter = 0;
00019a  2700              MOVS     r7,#0
;;;232        do
00019c  bf00              NOP      
                  |L3.414|
;;;233        {
;;;234          busystatus = CRYP_GetFlagStatus(CRYP_FLAG_BUSY);
00019e  2010              MOVS     r0,#0x10
0001a0  f7fffffe          BL       CRYP_GetFlagStatus
0001a4  4680              MOV      r8,r0
;;;235          counter++;
0001a6  1c7f              ADDS     r7,r7,#1
;;;236        }while ((counter != AESBUSY_TIMEOUT) && (busystatus != RESET));
0001a8  f5b73f80          CMP      r7,#0x10000
0001ac  d002              BEQ      |L3.436|
0001ae  f1b80f00          CMP      r8,#0
0001b2  d1f4              BNE      |L3.414|
                  |L3.436|
;;;237    
;;;238        if (busystatus != RESET)
0001b4  f1b80f00          CMP      r8,#0
0001b8  d002              BEQ      |L3.448|
;;;239       {
;;;240           status = ERROR;
0001ba  2000              MOVS     r0,#0
0001bc  9002              STR      r0,[sp,#8]
0001be  e00f              B        |L3.480|
                  |L3.448|
;;;241        }
;;;242        else
;;;243        {
;;;244    
;;;245          /* Read the Output block from the Output FIFO */
;;;246          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001c0  f7fffffe          BL       CRYP_DataOut
0001c4  6030              STR      r0,[r6,#0]
;;;247          outputaddr+=4;
0001c6  1d36              ADDS     r6,r6,#4
;;;248          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001c8  f7fffffe          BL       CRYP_DataOut
0001cc  6030              STR      r0,[r6,#0]
;;;249          outputaddr+=4;
0001ce  1d36              ADDS     r6,r6,#4
;;;250          *(uint32_t*)(outputaddr) = CRYP_DataOut();
0001d0  f7fffffe          BL       CRYP_DataOut
0001d4  6030              STR      r0,[r6,#0]
;;;251          outputaddr+=4;
0001d6  1d36              ADDS     r6,r6,#4
;;;252          *(uint32_t*)(outputaddr) = CRYP_DataOut(); 
0001d8  f7fffffe          BL       CRYP_DataOut
0001dc  6030              STR      r0,[r6,#0]
;;;253          outputaddr+=4;
0001de  1d36              ADDS     r6,r6,#4
                  |L3.480|
0001e0  9801              LDR      r0,[sp,#4]            ;217
0001e2  3010              ADDS     r0,r0,#0x10           ;217
0001e4  9001              STR      r0,[sp,#4]            ;217
                  |L3.486|
0001e6  991c              LDR      r1,[sp,#0x70]         ;217
0001e8  9801              LDR      r0,[sp,#4]            ;217
0001ea  4288              CMP      r0,r1                 ;217
0001ec  d202              BCS      |L3.500|
0001ee  9802              LDR      r0,[sp,#8]            ;217
0001f0  2800              CMP      r0,#0                 ;217
0001f2  d1c2              BNE      |L3.378|
                  |L3.500|
;;;254        }
;;;255      }
;;;256    
;;;257      /* Disable Crypto */
;;;258      CRYP_Cmd(DISABLE);
0001f4  2000              MOVS     r0,#0
0001f6  f7fffffe          BL       CRYP_Cmd
;;;259    
;;;260      return status; 
0001fa  9802              LDR      r0,[sp,#8]
;;;261    }
0001fc  b00d              ADD      sp,sp,#0x34
0001fe  ecbd8b02          VPOP     {d8}
000202  b004              ADD      sp,sp,#0x10
000204  e8bd8ff0          POP      {r4-r11,pc}
;;;262    
                          ENDP


;*** Start embedded assembler ***

#line 1 "..\\..\\..\\Libraries\\STM32F4xx_StdPeriph_Driver\\src\\stm32f4xx_cryp_aes.c"
	AREA ||.rev16_text||, CODE, READONLY
	THUMB
	EXPORT |__asm___20_stm32f4xx_cryp_aes_c_c34cf6b8____REV16|
#line 114 "C:\\Keil\\ARM\\CMSIS\\Include\\core_cmInstr.h"
|__asm___20_stm32f4xx_cryp_aes_c_c34cf6b8____REV16| PROC
#line 115

 rev16 r0, r0
 bx lr
	ENDP
	AREA ||.revsh_text||, CODE, READONLY
	THUMB
	EXPORT |__asm___20_stm32f4xx_cryp_aes_c_c34cf6b8____REVSH|
#line 128
|__asm___20_stm32f4xx_cryp_aes_c_c34cf6b8____REVSH| PROC
#line 129

 revsh r0, r0
 bx lr
	ENDP

;*** End   embedded assembler ***
