1 .cpu cortex-m4 2 .eabi_attribute 20, 1 3 .eabi_attribute 21, 1 4 .eabi_attribute 23, 3 5 .eabi_attribute 24, 1 6 .eabi_attribute 25, 1 7 .eabi_attribute 26, 1 8 .eabi_attribute 30, 4 9 .eabi_attribute 34, 1 10 .eabi_attribute 18, 4 11 .file "speck3264.c" 12 .text 13 .Ltext0: 14 .cfi_sections .debug_frame 15 .section .text.FuncER16,"ax",%progbits 16 .align 1 17 .global FuncER16 18 .arch armv7e-m 19 .syntax unified 20 .thumb 21 .thumb_func 22 .fpu softvfp 24 FuncER16: 25 .LVL0: 26 .LFB3: 27 .file 1 "speck3264.c" 1:speck3264.c **** #include 2:speck3264.c **** #include 3:speck3264.c **** #include "speck.h" 4:speck3264.c **** 5:speck3264.c **** 6:speck3264.c **** // This function is only used for the "x86" Speck compilation and as reference 7:speck3264.c **** void FuncER16(u16 *x, u16 *y, u16 k) 8:speck3264.c **** { 28 .loc 1 8 1 view -0 29 .cfi_startproc 30 @ args = 0, pretend = 0, frame = 0 31 @ frame_needed = 0, uses_anonymous_args = 0 9:speck3264.c **** u16 tmp_x = *x; 32 .loc 1 9 5 view .LVU1 8:speck3264.c **** u16 tmp_x = *x; 33 .loc 1 8 1 is_stmt 0 view .LVU2 34 0000 30B5 push {r4, r5, lr} 35 .LCFI0: 36 .cfi_def_cfa_offset 12 37 .cfi_offset 4, -12 38 .cfi_offset 5, -8 39 .cfi_offset 14, -4 40 .loc 1 9 9 view .LVU3 41 0002 0588 ldrh r5, [r0] 42 .LVL1: 10:speck3264.c **** u16 tmp_y = *y; 43 .loc 1 10 5 is_stmt 1 view .LVU4 44 .loc 1 10 9 is_stmt 0 view .LVU5 45 0004 0C88 ldrh r4, [r1] 46 .LVL2: 11:speck3264.c **** 12:speck3264.c **** *x = (((tmp_x)>>(7)) | ((tmp_x)<<(16-(7)))); 47 .loc 1 12 5 is_stmt 1 view .LVU6 48 .loc 1 12 36 is_stmt 0 view .LVU7 49 0006 6B02 lsls r3, r5, #9 50 .loc 1 12 26 view .LVU8 51 0008 43EAD513 orr r3, r3, r5, lsr #7 52 000c 9BB2 uxth r3, r3 53 .loc 1 12 8 view .LVU9 54 000e 0380 strh r3, [r0] @ movhi 13:speck3264.c **** *x += *y; 55 .loc 1 13 5 is_stmt 1 view .LVU10 14:speck3264.c **** 15:speck3264.c **** *x = *x ^ k; 56 .loc 1 15 5 view .LVU11 13:speck3264.c **** *x += *y; 57 .loc 1 13 8 is_stmt 0 view .LVU12 58 0010 0D88 ldrh r5, [r1] 59 .LVL3: 13:speck3264.c **** *x += *y; 60 .loc 1 13 8 view .LVU13 61 0012 2B44 add r3, r3, r5 62 .loc 1 15 8 view .LVU14 63 0014 5A40 eors r2, r2, r3 64 .LVL4: 16:speck3264.c **** 17:speck3264.c **** *y = (((tmp_y)<<(2)) | (tmp_y>>(16-(2)))); 65 .loc 1 17 19 view .LVU15 66 0016 A300 lsls r3, r4, #2 67 .loc 1 17 26 view .LVU16 68 0018 43EA9433 orr r3, r3, r4, lsr #14 69 001c 9BB2 uxth r3, r3 15:speck3264.c **** 70 .loc 1 15 8 view .LVU17 71 001e 0280 strh r2, [r0] @ movhi 72 .loc 1 17 5 is_stmt 1 view .LVU18 73 .loc 1 17 8 is_stmt 0 view .LVU19 74 0020 0B80 strh r3, [r1] @ movhi 18:speck3264.c **** *y = *y ^ *x; 75 .loc 1 18 5 is_stmt 1 view .LVU20 76 .loc 1 18 8 is_stmt 0 view .LVU21 77 0022 0288 ldrh r2, [r0] 78 0024 5340 eors r3, r3, r2 79 0026 0B80 strh r3, [r1] @ movhi 19:speck3264.c **** 20:speck3264.c **** } 80 .loc 1 20 1 view .LVU22 81 0028 30BD pop {r4, r5, pc} 82 .loc 1 20 1 view .LVU23 83 .cfi_endproc 84 .LFE3: 86 .section .text.FuncER16_ASM,"ax",%progbits 87 .align 1 88 .global FuncER16_ASM 89 .syntax unified 90 .thumb 91 .thumb_func 92 .fpu softvfp 94 FuncER16_ASM: 95 .LVL5: 96 .LFB4: 21:speck3264.c **** 22:speck3264.c **** 23:speck3264.c **** #ifdef ARM 24:speck3264.c **** // This function is used when running on the CW 25:speck3264.c **** void FuncER16_ASM(u16 *x, u16 *y, u16 k) 26:speck3264.c **** { 97 .loc 1 26 1 is_stmt 1 view -0 98 .cfi_startproc 99 @ args = 0, pretend = 0, frame = 0 100 @ frame_needed = 0, uses_anonymous_args = 0 101 @ link register save eliminated. 27:speck3264.c **** 28:speck3264.c **** asm volatile ( 102 .loc 1 28 5 view .LVU25 103 .syntax unified 104 @ 28 "speck3264.c" 1 105 0000 00BF nop 106 0002 30B5 push {r4, r5, lr} 107 0004 0588 ldrh r5, [r0, #0] 108 0006 0C88 ldrh r4, [r1, #0] 109 0008 6B02 lsls r3, r5, #9 110 000a 43EAD513 orr.w r3, r3, r5, lsr #7 111 000e 9BB2 uxth r3, r3 112 0010 0380 strh r3, [r0, #0] 113 0012 0D88 ldrh r5, [r1, #0] 114 0014 2B44 add r3, r5 115 0016 5A40 eors r2, r3 116 0018 A300 lsls r3, r4, #2 117 001a 43EA9433 orr.w r3, r3, r4, lsr #14 118 001e 9BB2 uxth r3, r3 119 0020 0280 strh r2, [r0, #0] 120 0022 0B80 strh r3, [r1, #0] 121 0024 0288 ldrh r2, [r0, #0] 122 0026 5340 eors r3, r2 123 0028 0B80 strh r3, [r1, #0] 124 002a 30BD pop {r4, r5, pc} 125 126 @ 0 "" 2 29:speck3264.c **** "nop\n\t" 30:speck3264.c **** "push {r4, r5, lr}\n\t" 31:speck3264.c **** "ldrh r5, [r0, #0]\n\t" 32:speck3264.c **** "ldrh r4, [r1, #0]\n\t" 33:speck3264.c **** "lsls r3, r5, #9\n\t" 34:speck3264.c **** "orr.w r3, r3, r5, lsr #7\n\t" 35:speck3264.c **** "uxth r3, r3\n\t" 36:speck3264.c **** "strh r3, [r0, #0]\n\t" 37:speck3264.c **** "ldrh r5, [r1, #0]\n\t" 38:speck3264.c **** "add r3, r5\n\t" 39:speck3264.c **** "eors r2, r3\n\t" 40:speck3264.c **** "lsls r3, r4, #2\n\t" 41:speck3264.c **** "orr.w r3, r3, r4, lsr #14\n\t" 42:speck3264.c **** "uxth r3, r3\n\t" 43:speck3264.c **** "strh r2, [r0, #0]\n\t" 44:speck3264.c **** "strh r3, [r1, #0]\n\t" 45:speck3264.c **** "ldrh r2, [r0, #0]\n\t" 46:speck3264.c **** "eors r3, r2\n\t" 47:speck3264.c **** "strh r3, [r1, #0]\n\t" 48:speck3264.c **** "pop {r4, r5, pc}\n\t" 49:speck3264.c **** ); 50:speck3264.c **** 51:speck3264.c **** } 127 .loc 1 51 1 is_stmt 0 view .LVU26 128 .thumb 129 .syntax unified 130 002c 7047 bx lr 131 .cfi_endproc 132 .LFE4: 134 .section .text.Words16ToBytes,"ax",%progbits 135 .align 1 136 .global Words16ToBytes 137 .syntax unified 138 .thumb 139 .thumb_func 140 .fpu softvfp 142 Words16ToBytes: 143 .LVL6: 144 .LFB5: 52:speck3264.c **** #endif 53:speck3264.c **** 54:speck3264.c **** 55:speck3264.c **** void Words16ToBytes(u16 words[],u8 bytes[],int numwords) 56:speck3264.c **** { 145 .loc 1 56 1 is_stmt 1 view -0 146 .cfi_startproc 147 @ args = 0, pretend = 0, frame = 0 148 @ frame_needed = 0, uses_anonymous_args = 0 57:speck3264.c **** int i,j=0; 149 .loc 1 57 5 view .LVU28 58:speck3264.c **** for(i=0;i>8); 162 .loc 1 60 19 view .LVU32 163 0006 4D1C adds r5, r1, #1 164 .LVL8: 165 .L4: 58:speck3264.c **** bytes[j]=(u8)words[i]; 166 .loc 1 58 14 is_stmt 1 discriminator 1 view .LVU33 167 0008 9342 cmp r3, r2 168 000a 00DB blt .L5 61:speck3264.c **** j+=2; 62:speck3264.c **** } 63:speck3264.c **** } 169 .loc 1 63 1 is_stmt 0 view .LVU34 170 000c 30BD pop {r4, r5, pc} 171 .L5: 59:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 172 .loc 1 59 9 is_stmt 1 discriminator 3 view .LVU35 59:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 173 .loc 1 59 18 is_stmt 0 discriminator 3 view .LVU36 174 000e 30F8024F ldrh r4, [r0, #2]! 175 .LVL9: 59:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 176 .loc 1 59 18 discriminator 3 view .LVU37 177 0012 01F81340 strb r4, [r1, r3, lsl #1] 60:speck3264.c **** j+=2; 178 .loc 1 60 9 is_stmt 1 discriminator 3 view .LVU38 60:speck3264.c **** j+=2; 179 .loc 1 60 20 is_stmt 0 discriminator 3 view .LVU39 180 0016 0488 ldrh r4, [r0] 181 0018 240A lsrs r4, r4, #8 182 001a 05F81340 strb r4, [r5, r3, lsl #1] 61:speck3264.c **** j+=2; 183 .loc 1 61 9 is_stmt 1 discriminator 3 view .LVU40 184 .LVL10: 58:speck3264.c **** bytes[j]=(u8)words[i]; 185 .loc 1 58 25 discriminator 3 view .LVU41 186 001e 0133 adds r3, r3, #1 187 .LVL11: 58:speck3264.c **** bytes[j]=(u8)words[i]; 188 .loc 1 58 25 is_stmt 0 discriminator 3 view .LVU42 189 0020 F2E7 b .L4 190 .cfi_endproc 191 .LFE5: 193 .section .text.BytesToWords16,"ax",%progbits 194 .align 1 195 .global BytesToWords16 196 .syntax unified 197 .thumb 198 .thumb_func 199 .fpu softvfp 201 BytesToWords16: 202 .LVL12: 203 .LFB6: 64:speck3264.c **** 65:speck3264.c **** void BytesToWords16(u8 bytes[],u16 words[],int numbytes) 66:speck3264.c **** { 204 .loc 1 66 1 is_stmt 1 view -0 205 .cfi_startproc 206 @ args = 0, pretend = 0, frame = 0 207 @ frame_needed = 0, uses_anonymous_args = 0 67:speck3264.c **** int i,j=0; for(i=0;i=0;) DR16(Pt[1],Pt[0],rk[i--]); 470 .loc 1 135 5 is_stmt 1 view .LVU127 471 .LVL45: 472 .loc 1 135 15 view .LVU128 131:speck3264.c **** int i; 473 .loc 1 131 1 is_stmt 0 view .LVU129 474 0008 30B5 push {r4, r5, lr} 475 .LCFI5: 476 .cfi_def_cfa_offset 12 477 .cfi_offset 4, -12 478 .cfi_offset 5, -8 479 .cfi_offset 14, -4 480 000a 02F12C05 add r5, r2, #44 481 .LVL46: 482 .L16: 483 .loc 1 135 21 is_stmt 1 discriminator 3 view .LVU130 484 000e 4388 ldrh r3, [r0, #2] 485 0010 0488 ldrh r4, [r0] 486 0012 5C40 eors r4, r4, r3 487 0014 A103 lsls r1, r4, #14 488 0016 41EA9401 orr r1, r1, r4, lsr #2 489 001a 89B2 uxth r1, r1 490 001c 0180 strh r1, [r0] @ movhi 491 .loc 1 135 21 is_stmt 0 discriminator 3 view .LVU131 492 001e 35F8024D ldrh r4, [r5, #-2]! 493 0022 6340 eors r3, r3, r4 494 0024 5B1A subs r3, r3, r1 495 0026 99B2 uxth r1, r3 496 0028 C3F34623 ubfx r3, r3, #9, #7 497 002c 43EAC113 orr r3, r3, r1, lsl #7 498 .loc 1 135 15 discriminator 3 view .LVU132 499 0030 AA42 cmp r2, r5 500 .loc 1 135 21 discriminator 3 view .LVU133 501 0032 4380 strh r3, [r0, #2] @ movhi 502 .loc 1 135 15 is_stmt 1 discriminator 3 view .LVU134 503 0034 EBD1 bne .L16 136:speck3264.c **** } 504 .loc 1 136 1 is_stmt 0 view .LVU135 505 0036 30BD pop {r4, r5, pc} 506 .cfi_endproc 507 .LFE9: 509 .section .text.Speck3264_EncryptBlock,"ax",%progbits 510 .align 1 511 .global Speck3264_EncryptBlock 512 .syntax unified 513 .thumb 514 .thumb_func 515 .fpu softvfp 517 Speck3264_EncryptBlock: 518 .LVL47: 519 .LFB10: 137:speck3264.c **** 138:speck3264.c **** 139:speck3264.c **** void Speck3264_EncryptBlock(u8 pt[], u8 k[], u8 ct[]) { 520 .loc 1 139 55 is_stmt 1 view -0 521 .cfi_startproc 522 @ args = 0, pretend = 0, frame = 88 523 @ frame_needed = 0, uses_anonymous_args = 0 140:speck3264.c **** 141:speck3264.c **** u16 Pt[2] = {0}; 524 .loc 1 141 5 view .LVU137 139:speck3264.c **** 525 .loc 1 139 55 is_stmt 0 view .LVU138 526 0000 F0B5 push {r4, r5, r6, r7, lr} 527 .LCFI6: 528 .cfi_def_cfa_offset 20 529 .cfi_offset 4, -20 530 .cfi_offset 5, -16 531 .cfi_offset 6, -12 532 .cfi_offset 7, -8 533 .cfi_offset 14, -4 534 .loc 1 141 9 view .LVU139 535 0002 0024 movs r4, #0 139:speck3264.c **** 536 .loc 1 139 55 view .LVU140 537 0004 97B0 sub sp, sp, #92 538 .LCFI7: 539 .cfi_def_cfa_offset 112 139:speck3264.c **** 540 .loc 1 139 55 view .LVU141 541 0006 0746 mov r7, r0 542 0008 0E46 mov r6, r1 543 000a 1546 mov r5, r2 142:speck3264.c **** u16 K[4] = {0}; 143:speck3264.c **** u16 rk[34] = {0}; 544 .loc 1 143 9 view .LVU142 545 000c 2146 mov r1, r4 546 .LVL48: 547 .loc 1 143 9 view .LVU143 548 000e 4422 movs r2, #68 549 .LVL49: 550 .loc 1 143 9 view .LVU144 551 0010 05A8 add r0, sp, #20 552 .LVL50: 142:speck3264.c **** u16 K[4] = {0}; 553 .loc 1 142 9 view .LVU145 554 0012 CDE90344 strd r4, r4, [sp, #12] 141:speck3264.c **** u16 K[4] = {0}; 555 .loc 1 141 9 view .LVU146 556 0016 0194 str r4, [sp, #4] 142:speck3264.c **** u16 K[4] = {0}; 557 .loc 1 142 5 is_stmt 1 view .LVU147 558 .loc 1 143 5 view .LVU148 559 .loc 1 143 9 is_stmt 0 view .LVU149 560 0018 FFF7FEFF bl memset 561 .LVL51: 144:speck3264.c **** u16 Ct[2] = {0}; 562 .loc 1 144 5 is_stmt 1 view .LVU150 145:speck3264.c **** 146:speck3264.c **** BytesToWords16(pt,Pt,8); 563 .loc 1 146 5 is_stmt 0 view .LVU151 564 001c 01A9 add r1, sp, #4 565 001e 3846 mov r0, r7 566 0020 0822 movs r2, #8 144:speck3264.c **** u16 Ct[2] = {0}; 567 .loc 1 144 9 view .LVU152 568 0022 0294 str r4, [sp, #8] 569 .loc 1 146 5 is_stmt 1 view .LVU153 570 0024 FFF7FEFF bl BytesToWords16 571 .LVL52: 147:speck3264.c **** BytesToWords16(k,K,16); 572 .loc 1 147 5 view .LVU154 573 0028 1022 movs r2, #16 574 002a 03A9 add r1, sp, #12 575 002c 3046 mov r0, r6 576 002e FFF7FEFF bl BytesToWords16 577 .LVL53: 148:speck3264.c **** 149:speck3264.c **** 150:speck3264.c **** Speck3264KeySchedule(K,rk); 578 .loc 1 150 5 view .LVU155 579 0032 05A9 add r1, sp, #20 580 0034 03A8 add r0, sp, #12 581 0036 FFF7FEFF bl Speck3264KeySchedule 582 .LVL54: 151:speck3264.c **** 152:speck3264.c **** #ifndef ARM 153:speck3264.c **** // DEBUG Purposes 154:speck3264.c **** for (int i=0; i < 16; i++) 155:speck3264.c **** { 156:speck3264.c **** printf("Key: 0x%x\n", rk[i]); 157:speck3264.c **** } 158:speck3264.c **** #endif 159:speck3264.c **** Speck3264Encrypt(Pt,Ct,rk); 583 .loc 1 159 5 view .LVU156 584 003a 05AA add r2, sp, #20 585 003c 02A9 add r1, sp, #8 586 003e 01A8 add r0, sp, #4 587 0040 FFF7FEFF bl Speck3264Encrypt 588 .LVL55: 160:speck3264.c **** Words16ToBytes(Ct,ct,2); 589 .loc 1 160 5 view .LVU157 590 0044 0222 movs r2, #2 591 0046 2946 mov r1, r5 592 0048 02A8 add r0, sp, #8 593 004a FFF7FEFF bl Words16ToBytes 594 .LVL56: 161:speck3264.c **** } 595 .loc 1 161 1 is_stmt 0 view .LVU158 596 004e 17B0 add sp, sp, #92 597 .LCFI8: 598 .cfi_def_cfa_offset 20 599 @ sp needed 600 0050 F0BD pop {r4, r5, r6, r7, pc} 601 .loc 1 161 1 view .LVU159 602 .cfi_endproc 603 .LFE10: 605 .text 606 .Letext0: 607 .file 2 "/usr/arm-none-eabi/include/machine/_default_types.h" 608 .file 3 "/usr/arm-none-eabi/include/sys/_stdint.h" 609 .file 4 "" DEFINED SYMBOLS *ABS*:0000000000000000 speck3264.c /tmp/cc3Lq9np.s:16 .text.FuncER16:0000000000000000 $t /tmp/cc3Lq9np.s:24 .text.FuncER16:0000000000000000 FuncER16 /tmp/cc3Lq9np.s:87 .text.FuncER16_ASM:0000000000000000 $t /tmp/cc3Lq9np.s:94 .text.FuncER16_ASM:0000000000000000 FuncER16_ASM /tmp/cc3Lq9np.s:135 .text.Words16ToBytes:0000000000000000 $t /tmp/cc3Lq9np.s:142 .text.Words16ToBytes:0000000000000000 Words16ToBytes /tmp/cc3Lq9np.s:194 .text.BytesToWords16:0000000000000000 $t /tmp/cc3Lq9np.s:201 .text.BytesToWords16:0000000000000000 BytesToWords16 /tmp/cc3Lq9np.s:255 .text.Speck3264KeySchedule:0000000000000000 $t /tmp/cc3Lq9np.s:262 .text.Speck3264KeySchedule:0000000000000000 Speck3264KeySchedule /tmp/cc3Lq9np.s:389 .text.Speck3264Encrypt:0000000000000000 $t /tmp/cc3Lq9np.s:396 .text.Speck3264Encrypt:0000000000000000 Speck3264Encrypt /tmp/cc3Lq9np.s:446 .text.Speck3264Decrypt:0000000000000000 $t /tmp/cc3Lq9np.s:453 .text.Speck3264Decrypt:0000000000000000 Speck3264Decrypt /tmp/cc3Lq9np.s:510 .text.Speck3264_EncryptBlock:0000000000000000 $t /tmp/cc3Lq9np.s:517 .text.Speck3264_EncryptBlock:0000000000000000 Speck3264_EncryptBlock UNDEFINED SYMBOLS memset