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.Words16ToBytes,"ax",%progbits 16 .align 1 17 .global Words16ToBytes 18 .arch armv7e-m 19 .syntax unified 20 .thumb 21 .thumb_func 22 .fpu softvfp 24 Words16ToBytes: 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 **** void Words16ToBytes(u16 words[],u8 bytes[],int numwords) 7:speck3264.c **** { 28 .loc 1 7 1 view -0 29 .cfi_startproc 30 @ args = 0, pretend = 0, frame = 0 31 @ frame_needed = 0, uses_anonymous_args = 0 8:speck3264.c **** int i,j=0; 32 .loc 1 8 5 view .LVU1 9:speck3264.c **** for(i=0;i>8); 45 .loc 1 11 19 view .LVU5 46 0006 4D1C adds r5, r1, #1 47 .LVL2: 48 .L2: 9:speck3264.c **** bytes[j]=(u8)words[i]; 49 .loc 1 9 14 is_stmt 1 discriminator 1 view .LVU6 50 0008 9342 cmp r3, r2 51 000a 00DB blt .L3 12:speck3264.c **** j+=2; 13:speck3264.c **** } 14:speck3264.c **** } 52 .loc 1 14 1 is_stmt 0 view .LVU7 53 000c 30BD pop {r4, r5, pc} 54 .L3: 10:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 55 .loc 1 10 9 is_stmt 1 discriminator 3 view .LVU8 10:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 56 .loc 1 10 18 is_stmt 0 discriminator 3 view .LVU9 57 000e 30F8024F ldrh r4, [r0, #2]! 58 .LVL3: 10:speck3264.c **** bytes[j+1]=(u8)(words[i]>>8); 59 .loc 1 10 18 discriminator 3 view .LVU10 60 0012 01F81340 strb r4, [r1, r3, lsl #1] 11:speck3264.c **** j+=2; 61 .loc 1 11 9 is_stmt 1 discriminator 3 view .LVU11 11:speck3264.c **** j+=2; 62 .loc 1 11 20 is_stmt 0 discriminator 3 view .LVU12 63 0016 0488 ldrh r4, [r0] 64 0018 240A lsrs r4, r4, #8 65 001a 05F81340 strb r4, [r5, r3, lsl #1] 12:speck3264.c **** j+=2; 66 .loc 1 12 9 is_stmt 1 discriminator 3 view .LVU13 67 .LVL4: 9:speck3264.c **** bytes[j]=(u8)words[i]; 68 .loc 1 9 25 discriminator 3 view .LVU14 69 001e 0133 adds r3, r3, #1 70 .LVL5: 9:speck3264.c **** bytes[j]=(u8)words[i]; 71 .loc 1 9 25 is_stmt 0 discriminator 3 view .LVU15 72 0020 F2E7 b .L2 73 .cfi_endproc 74 .LFE3: 76 .section .text.BytesToWords16,"ax",%progbits 77 .align 1 78 .global BytesToWords16 79 .syntax unified 80 .thumb 81 .thumb_func 82 .fpu softvfp 84 BytesToWords16: 85 .LVL6: 86 .LFB4: 15:speck3264.c **** 16:speck3264.c **** void BytesToWords16(u8 bytes[],u16 words[],int numbytes) 17:speck3264.c **** { 87 .loc 1 17 1 is_stmt 1 view -0 88 .cfi_startproc 89 @ args = 0, pretend = 0, frame = 0 90 @ frame_needed = 0, uses_anonymous_args = 0 18:speck3264.c **** int i,j=0; for(i=0;i=0;) DR16(Pt[1],Pt[0],rk[i--]); 365 .loc 1 84 5 is_stmt 1 view .LVU101 366 .LVL38: 367 .loc 1 84 15 view .LVU102 80:speck3264.c **** int i; 368 .loc 1 80 1 is_stmt 0 view .LVU103 369 0008 30B5 push {r4, r5, lr} 370 .LCFI4: 371 .cfi_def_cfa_offset 12 372 .cfi_offset 4, -12 373 .cfi_offset 5, -8 374 .cfi_offset 14, -4 375 000a 02F12C05 add r5, r2, #44 376 .LVL39: 377 .L14: 378 .loc 1 84 21 is_stmt 1 discriminator 3 view .LVU104 379 000e 4388 ldrh r3, [r0, #2] 380 0010 0488 ldrh r4, [r0] 381 0012 5C40 eors r4, r4, r3 382 0014 A103 lsls r1, r4, #14 383 0016 41EA9401 orr r1, r1, r4, lsr #2 384 001a 89B2 uxth r1, r1 385 001c 0180 strh r1, [r0] @ movhi 386 .loc 1 84 21 is_stmt 0 discriminator 3 view .LVU105 387 001e 35F8024D ldrh r4, [r5, #-2]! 388 0022 6340 eors r3, r3, r4 389 0024 5B1A subs r3, r3, r1 390 0026 99B2 uxth r1, r3 391 0028 C3F34623 ubfx r3, r3, #9, #7 392 002c 43EAC113 orr r3, r3, r1, lsl #7 393 .loc 1 84 15 discriminator 3 view .LVU106 394 0030 AA42 cmp r2, r5 395 .loc 1 84 21 discriminator 3 view .LVU107 396 0032 4380 strh r3, [r0, #2] @ movhi 397 .loc 1 84 15 is_stmt 1 discriminator 3 view .LVU108 398 0034 EBD1 bne .L14 85:speck3264.c **** } 399 .loc 1 85 1 is_stmt 0 view .LVU109 400 0036 30BD pop {r4, r5, pc} 401 .cfi_endproc 402 .LFE7: 404 .section .text.Speck3264_EncryptBlock,"ax",%progbits 405 .align 1 406 .global Speck3264_EncryptBlock 407 .syntax unified 408 .thumb 409 .thumb_func 410 .fpu softvfp 412 Speck3264_EncryptBlock: 413 .LVL40: 414 .LFB8: 86:speck3264.c **** 87:speck3264.c **** 88:speck3264.c **** void Speck3264_EncryptBlock(u8 pt[], u8 k[], u8 ct[]) { 415 .loc 1 88 55 is_stmt 1 view -0 416 .cfi_startproc 417 @ args = 0, pretend = 0, frame = 88 418 @ frame_needed = 0, uses_anonymous_args = 0 89:speck3264.c **** 90:speck3264.c **** u16 Pt[2] = {0}; 419 .loc 1 90 5 view .LVU111 88:speck3264.c **** 420 .loc 1 88 55 is_stmt 0 view .LVU112 421 0000 F0B5 push {r4, r5, r6, r7, lr} 422 .LCFI5: 423 .cfi_def_cfa_offset 20 424 .cfi_offset 4, -20 425 .cfi_offset 5, -16 426 .cfi_offset 6, -12 427 .cfi_offset 7, -8 428 .cfi_offset 14, -4 429 .loc 1 90 9 view .LVU113 430 0002 0024 movs r4, #0 88:speck3264.c **** 431 .loc 1 88 55 view .LVU114 432 0004 97B0 sub sp, sp, #92 433 .LCFI6: 434 .cfi_def_cfa_offset 112 88:speck3264.c **** 435 .loc 1 88 55 view .LVU115 436 0006 0746 mov r7, r0 437 0008 0E46 mov r6, r1 438 000a 1546 mov r5, r2 91:speck3264.c **** u16 K[4] = {0}; 92:speck3264.c **** u16 rk[34] = {0}; 439 .loc 1 92 9 view .LVU116 440 000c 2146 mov r1, r4 441 .LVL41: 442 .loc 1 92 9 view .LVU117 443 000e 4422 movs r2, #68 444 .LVL42: 445 .loc 1 92 9 view .LVU118 446 0010 05A8 add r0, sp, #20 447 .LVL43: 91:speck3264.c **** u16 K[4] = {0}; 448 .loc 1 91 9 view .LVU119 449 0012 CDE90344 strd r4, r4, [sp, #12] 90:speck3264.c **** u16 K[4] = {0}; 450 .loc 1 90 9 view .LVU120 451 0016 0194 str r4, [sp, #4] 91:speck3264.c **** u16 K[4] = {0}; 452 .loc 1 91 5 is_stmt 1 view .LVU121 453 .loc 1 92 5 view .LVU122 454 .loc 1 92 9 is_stmt 0 view .LVU123 455 0018 FFF7FEFF bl memset 456 .LVL44: 93:speck3264.c **** u16 Ct[2] = {0}; 457 .loc 1 93 5 is_stmt 1 view .LVU124 94:speck3264.c **** 95:speck3264.c **** BytesToWords16(pt,Pt,8); 458 .loc 1 95 5 is_stmt 0 view .LVU125 459 001c 01A9 add r1, sp, #4 460 001e 3846 mov r0, r7 461 0020 0822 movs r2, #8 93:speck3264.c **** u16 Ct[2] = {0}; 462 .loc 1 93 9 view .LVU126 463 0022 0294 str r4, [sp, #8] 464 .loc 1 95 5 is_stmt 1 view .LVU127 465 0024 FFF7FEFF bl BytesToWords16 466 .LVL45: 96:speck3264.c **** BytesToWords16(k,K,16); 467 .loc 1 96 5 view .LVU128 468 0028 1022 movs r2, #16 469 002a 03A9 add r1, sp, #12 470 002c 3046 mov r0, r6 471 002e FFF7FEFF bl BytesToWords16 472 .LVL46: 97:speck3264.c **** 98:speck3264.c **** 99:speck3264.c **** Speck3264KeySchedule(K,rk); 473 .loc 1 99 5 view .LVU129 474 0032 05A9 add r1, sp, #20 475 0034 03A8 add r0, sp, #12 476 0036 FFF7FEFF bl Speck3264KeySchedule 477 .LVL47: 100:speck3264.c **** 101:speck3264.c **** // DEBUG Purposes 102:speck3264.c **** 103:speck3264.c **** #ifndef ARM 104:speck3264.c **** for (int i=0; i < 16; i++) 105:speck3264.c **** { 106:speck3264.c **** printf("Key: 0x%x\n", rk[i]); 107:speck3264.c **** } 108:speck3264.c **** #endif 109:speck3264.c **** Speck3264Encrypt(Pt,Ct,rk); 478 .loc 1 109 5 view .LVU130 479 003a 05AA add r2, sp, #20 480 003c 02A9 add r1, sp, #8 481 003e 01A8 add r0, sp, #4 482 0040 FFF7FEFF bl Speck3264Encrypt 483 .LVL48: 110:speck3264.c **** Words16ToBytes(Ct,ct,2); 484 .loc 1 110 5 view .LVU131 485 0044 0222 movs r2, #2 486 0046 2946 mov r1, r5 487 0048 02A8 add r0, sp, #8 488 004a FFF7FEFF bl Words16ToBytes 489 .LVL49: 111:speck3264.c **** } 490 .loc 1 111 1 is_stmt 0 view .LVU132 491 004e 17B0 add sp, sp, #92 492 .LCFI7: 493 .cfi_def_cfa_offset 20 494 @ sp needed 495 0050 F0BD pop {r4, r5, r6, r7, pc} 496 .loc 1 111 1 view .LVU133 497 .cfi_endproc 498 .LFE8: 500 .text 501 .Letext0: 502 .file 2 "/usr/arm-none-eabi/include/machine/_default_types.h" 503 .file 3 "/usr/arm-none-eabi/include/sys/_stdint.h" 504 .file 4 "" DEFINED SYMBOLS *ABS*:0000000000000000 speck3264.c /tmp/cc1zOjum.s:16 .text.Words16ToBytes:0000000000000000 $t /tmp/cc1zOjum.s:24 .text.Words16ToBytes:0000000000000000 Words16ToBytes /tmp/cc1zOjum.s:77 .text.BytesToWords16:0000000000000000 $t /tmp/cc1zOjum.s:84 .text.BytesToWords16:0000000000000000 BytesToWords16 /tmp/cc1zOjum.s:138 .text.Speck3264KeySchedule:0000000000000000 $t /tmp/cc1zOjum.s:145 .text.Speck3264KeySchedule:0000000000000000 Speck3264KeySchedule /tmp/cc1zOjum.s:272 .text.Speck3264Encrypt:0000000000000000 $t /tmp/cc1zOjum.s:279 .text.Speck3264Encrypt:0000000000000000 Speck3264Encrypt /tmp/cc1zOjum.s:341 .text.Speck3264Decrypt:0000000000000000 $t /tmp/cc1zOjum.s:348 .text.Speck3264Decrypt:0000000000000000 Speck3264Decrypt /tmp/cc1zOjum.s:405 .text.Speck3264_EncryptBlock:0000000000000000 $t /tmp/cc1zOjum.s:412 .text.Speck3264_EncryptBlock:0000000000000000 Speck3264_EncryptBlock UNDEFINED SYMBOLS memset