RTEMS-6
Annotated Report
libcrypt
Sun Feb 28 12:43:03 2021
4000184c <_crypt_b64_from_24bit>:
{
uint32_t w;
int i;
#if defined(__rtems__)
w = ((uint32_t)B2 << 16) | ((uint32_t)B1 << 8) | B0;
4000184c: 00859593 slli a1,a1,0x8
40001850: 00c5e5b3 or a1,a1,a2
40001854: 01051513 slli a0,a0,0x10
40001858: 00a5e533 or a0,a1,a0
#else
w = (B2 << 16) | (B1 << 8) | B0;
#endif
for (i = 0; i < n; i++) {
4000185c: 04d05863 blez a3,400018ac <_crypt_b64_from_24bit+0x60> <== NEVER TAKEN
40001860: 40023337 lui t1,0x40023
**cp = itoa64[w&0x3f];
40001864: 0007a603 lw a2,0(a5)
for (i = 0; i < n; i++) {
40001868: 00000813 li a6,0
4000186c: 8b830313 addi t1,t1,-1864 # 400228b8 <itoa64>
40001870: 0080006f j 40001878 <_crypt_b64_from_24bit+0x2c>
40001874: 03068c63 beq a3,a6,400018ac <_crypt_b64_from_24bit+0x60>
**cp = itoa64[w&0x3f];
40001878: 03f57593 andi a1,a0,63
4000187c: 00b305b3 add a1,t1,a1
40001880: 0005c583 lbu a1,0(a1)
for (i = 0; i < n; i++) {
40001884: 00180813 addi a6,a6,1
(*cp)++;
if ((*buflen)-- < 0)
break;
w >>= 6;
40001888: 00655513 srli a0,a0,0x6
**cp = itoa64[w&0x3f];
4000188c: 00b60023 sb a1,0(a2)
(*cp)++;
40001890: 0007a603 lw a2,0(a5)
if ((*buflen)-- < 0)
40001894: 00072583 lw a1,0(a4)
(*cp)++;
40001898: 00160613 addi a2,a2,1
4000189c: 00c7a023 sw a2,0(a5)
if ((*buflen)-- < 0)
400018a0: fff58893 addi a7,a1,-1
400018a4: 01172023 sw a7,0(a4)
400018a8: fc05d6e3 bgez a1,40001874 <_crypt_b64_from_24bit+0x28> <== ALWAYS TAKEN
}
}
400018ac: 00008067 ret
4000181c <_crypt_to64>:
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
void
_crypt_to64(char *s, u_long v, int n)
{
while (--n >= 0) {
4000181c: 02c05663 blez a2,40001848 <_crypt_to64+0x2c> <== NEVER TAKEN
40001820: 40023737 lui a4,0x40023
40001824: 00c50633 add a2,a0,a2
40001828: 8b870713 addi a4,a4,-1864 # 400228b8 <itoa64>
*s++ = itoa64[v&0x3f];
4000182c: 03f5f793 andi a5,a1,63
40001830: 00f707b3 add a5,a4,a5
40001834: 0007c783 lbu a5,0(a5)
40001838: 00150513 addi a0,a0,1
v >>= 6;
4000183c: 0065d593 srli a1,a1,0x6
*s++ = itoa64[v&0x3f];
40001840: fef50fa3 sb a5,-1(a0)
while (--n >= 0) {
40001844: fea614e3 bne a2,a0,4000182c <_crypt_to64+0x10>
}
}
40001848: 00008067 ret
4000051c <crypt_add_format>:
&cf_default
};
void crypt_add_format(struct crypt_format *cf)
{
if (cf->link.sle_next == NULL)
4000051c: 00052783 lw a5,0(a0)
40000520: 00078463 beqz a5,40000528 <crypt_add_format+0xc> <== ALWAYS TAKEN
SLIST_INSERT_HEAD(&cf_head, cf, link);
}
40000524: 00008067 ret <== NOT EXECUTED
SLIST_INSERT_HEAD(&cf_head, cf, link);
40000528: bac18793 addi a5,gp,-1108 # 40024e6c <cf_head>
4000052c: 0007a703 lw a4,0(a5)
40000530: 00a7a023 sw a0,0(a5)
40000534: 00e52023 sw a4,0(a0)
}
40000538: 00008067 ret
400005c4 <crypt_md5_r>:
* UNIX password
*/
char *
crypt_md5_r(const char *pw, const char *salt, struct crypt_data *data)
{
400005c4: ef010113 addi sp,sp,-272
400005c8: 11212023 sw s2,256(sp)
400005cc: 0f712623 sw s7,236(sp)
400005d0: 0f812423 sw s8,232(sp)
400005d4: 10112623 sw ra,268(sp)
400005d8: 10812423 sw s0,264(sp)
400005dc: 10912223 sw s1,260(sp)
400005e0: 0f312e23 sw s3,252(sp)
400005e4: 0f412c23 sw s4,248(sp)
400005e8: 0f512a23 sw s5,244(sp)
400005ec: 0f612823 sw s6,240(sp)
/* Refine the Salt first */
sp = salt;
/* If it starts with the magic string, then skip that */
if(!strncmp(sp, magic, strlen(magic)))
400005f0: 0005c783 lbu a5,0(a1)
{
400005f4: 00058b93 mv s7,a1
400005f8: 00050913 mv s2,a0
if(!strncmp(sp, magic, strlen(magic)))
400005fc: fdc78793 addi a5,a5,-36
{
40000600: 00060c13 mv s8,a2
if(!strncmp(sp, magic, strlen(magic)))
40000604: 02079063 bnez a5,40000624 <crypt_md5_r+0x60> <== NEVER TAKEN
40000608: 0015c783 lbu a5,1(a1)
4000060c: fcf78793 addi a5,a5,-49
40000610: 00079a63 bnez a5,40000624 <crypt_md5_r+0x60> <== NEVER TAKEN
40000614: 0025c783 lbu a5,2(a1)
40000618: fdc78793 addi a5,a5,-36
4000061c: 00079463 bnez a5,40000624 <crypt_md5_r+0x60> <== NEVER TAKEN
sp += strlen(magic);
40000620: 00358b93 addi s7,a1,3
/* It stops at the first '$', max 8 chars */
for(ep = sp; *ep && *ep != '$' && ep < (sp + 8); ep++)
40000624: 000bc783 lbu a5,0(s7)
40000628: 008b8713 addi a4,s7,8
4000062c: 000b8b13 mv s6,s7
40000630: 02400693 li a3,36
40000634: 38078a63 beqz a5,400009c8 <crypt_md5_r+0x404> <== NEVER TAKEN
40000638: 00d78a63 beq a5,a3,4000064c <crypt_md5_r+0x88>
4000063c: 01670c63 beq a4,s6,40000654 <crypt_md5_r+0x90>
40000640: 001b4783 lbu a5,1(s6)
40000644: 001b0b13 addi s6,s6,1
40000648: fe0798e3 bnez a5,40000638 <crypt_md5_r+0x74>
continue;
/* get the length of the true salt */
sl = ep - sp;
4000064c: 417b0b33 sub s6,s6,s7
40000650: 0080006f j 40000658 <crypt_md5_r+0x94>
40000654: 41770b33 sub s6,a4,s7 <== NOT EXECUTED
MD5Init(&ctx);
40000658: 01010513 addi a0,sp,16
4000065c: 0b4050ef jal ra,40005710 <MD5Init>
/* The password first, since that is what is most unknown */
MD5Update(&ctx, (const u_char *)pw, strlen(pw));
40000660: 00090513 mv a0,s2
40000664: 2fc1b0ef jal ra,4001b960 <strlen>
40000668: 00050613 mv a2,a0
4000066c: 00090593 mv a1,s2
40000670: 01010513 addi a0,sp,16
40000674: 0d8050ef jal ra,4000574c <MD5Update>
/* Then our magic string */
MD5Update(&ctx, (const u_char *)magic, strlen(magic));
40000678: 00300613 li a2,3
4000067c: b5418593 addi a1,gp,-1196 # 40024e14 <magic.0>
40000680: 01010513 addi a0,sp,16
40000684: 0c8050ef jal ra,4000574c <MD5Update>
/* Then the raw salt */
MD5Update(&ctx, (const u_char *)sp, (u_int)sl);
40000688: 000b0613 mv a2,s6
4000068c: 000b8593 mv a1,s7
40000690: 01010513 addi a0,sp,16
40000694: 0b8050ef jal ra,4000574c <MD5Update>
/* Then just as many characters of the MD5(pw,salt,pw) */
MD5Init(&ctx1);
40000698: 07810513 addi a0,sp,120
4000069c: 074050ef jal ra,40005710 <MD5Init>
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
400006a0: 00090513 mv a0,s2
400006a4: 2bc1b0ef jal ra,4001b960 <strlen>
400006a8: 00050613 mv a2,a0
400006ac: 00090593 mv a1,s2
400006b0: 07810513 addi a0,sp,120
400006b4: 098050ef jal ra,4000574c <MD5Update>
MD5Update(&ctx1, (const u_char *)sp, (u_int)sl);
400006b8: 000b0613 mv a2,s6
400006bc: 000b8593 mv a1,s7
400006c0: 07810513 addi a0,sp,120
400006c4: 088050ef jal ra,4000574c <MD5Update>
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
400006c8: 00090513 mv a0,s2
400006cc: 2941b0ef jal ra,4001b960 <strlen>
400006d0: 00050613 mv a2,a0
400006d4: 00090593 mv a1,s2
400006d8: 07810513 addi a0,sp,120
400006dc: 070050ef jal ra,4000574c <MD5Update>
MD5Final(final, &ctx1);
400006e0: 07810593 addi a1,sp,120
400006e4: 00010513 mv a0,sp
400006e8: 168050ef jal ra,40005850 <MD5Final>
for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE)
400006ec: 00090513 mv a0,s2
400006f0: 2701b0ef jal ra,4001b960 <strlen>
400006f4: 00050413 mv s0,a0
400006f8: 02050c63 beqz a0,40000730 <crypt_md5_r+0x16c> <== NEVER TAKEN
400006fc: fff50793 addi a5,a0,-1
40000700: ff050493 addi s1,a0,-16
40000704: ff07f793 andi a5,a5,-16
40000708: 40f484b3 sub s1,s1,a5
MD5Update(&ctx, (const u_char *)final,
(u_int)(pl > MD5_SIZE ? MD5_SIZE : pl));
4000070c: 01000993 li s3,16
MD5Update(&ctx, (const u_char *)final,
40000710: 00010593 mv a1,sp
40000714: 01010513 addi a0,sp,16
(u_int)(pl > MD5_SIZE ? MD5_SIZE : pl));
40000718: 00040613 mv a2,s0
4000071c: 0089d463 bge s3,s0,40000724 <crypt_md5_r+0x160>
40000720: 01000613 li a2,16 <== NOT EXECUTED
for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE)
40000724: ff040413 addi s0,s0,-16
MD5Update(&ctx, (const u_char *)final,
40000728: 024050ef jal ra,4000574c <MD5Update>
for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE)
4000072c: fe9412e3 bne s0,s1,40000710 <crypt_md5_r+0x14c>
/* Don't leave anything around in vm they could use. */
memset(final, 0, sizeof(final));
/* Then something really weird... */
for (i = strlen(pw); i; i >>= 1)
40000730: 00090513 mv a0,s2
memset(final, 0, sizeof(final));
40000734: 00012023 sw zero,0(sp)
40000738: 00012223 sw zero,4(sp)
4000073c: 00012423 sw zero,8(sp)
40000740: 00012623 sw zero,12(sp)
for (i = strlen(pw); i; i >>= 1)
40000744: 21c1b0ef jal ra,4001b960 <strlen>
40000748: 00050413 mv s0,a0
4000074c: 02050863 beqz a0,4000077c <crypt_md5_r+0x1b8> <== NEVER TAKEN
if(i & 1)
40000750: 00147793 andi a5,s0,1
MD5Update(&ctx, (const u_char *)final, 1);
40000754: 00100613 li a2,1
40000758: 00010593 mv a1,sp
4000075c: 01010513 addi a0,sp,16
if(i & 1)
40000760: 00079863 bnez a5,40000770 <crypt_md5_r+0x1ac>
else
MD5Update(&ctx, (const u_char *)pw, 1);
40000764: 00100613 li a2,1
40000768: 00090593 mv a1,s2
4000076c: 01010513 addi a0,sp,16
for (i = strlen(pw); i; i >>= 1)
40000770: 00145413 srli s0,s0,0x1
MD5Update(&ctx, (const u_char *)pw, 1);
40000774: 7d9040ef jal ra,4000574c <MD5Update>
for (i = strlen(pw); i; i >>= 1)
40000778: fc041ce3 bnez s0,40000750 <crypt_md5_r+0x18c>
/* Now make the output string */
strcpy(passwd, magic);
4000077c: 40023737 lui a4,0x40023
40000780: 8a070793 addi a5,a4,-1888 # 400228a0 <test_cases_sha512+0x54>
40000784: 0017c683 lbu a3,1(a5)
40000788: 8a074503 lbu a0,-1888(a4)
4000078c: 0027c703 lbu a4,2(a5)
40000790: 0037c783 lbu a5,3(a5)
strncat(passwd, sp, (u_int)sl);
40000794: 000b0613 mv a2,s6
40000798: 000b8593 mv a1,s7
strcpy(passwd, magic);
4000079c: 00dc00a3 sb a3,1(s8)
400007a0: 00ec0123 sb a4,2(s8)
400007a4: 00fc01a3 sb a5,3(s8)
400007a8: 00ac0023 sb a0,0(s8)
strncat(passwd, sp, (u_int)sl);
400007ac: 000c0513 mv a0,s8
400007b0: 23c1b0ef jal ra,4001b9ec <strncat>
strcat(passwd, "$");
400007b4: 000c0513 mv a0,s8
400007b8: 1a81b0ef jal ra,4001b960 <strlen>
400007bc: 00ac07b3 add a5,s8,a0
400007c0: 02400713 li a4,36
400007c4: 00e78023 sb a4,0(a5)
400007c8: 000780a3 sb zero,1(a5)
MD5Final(final, &ctx);
400007cc: 01010593 addi a1,sp,16
400007d0: 00010513 mv a0,sp
400007d4: 07c050ef jal ra,40005850 <MD5Final>
/*
* and now, just to make sure things don't run too fast
* On a 60 Mhz Pentium this takes 34 msec, so you would
* need 30 seconds to build a 1000 entry dictionary...
*/
for(i = 0; i < 1000; i++) {
400007d8: 00000413 li s0,0
MD5Init(&ctx1);
if(i & 1)
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
else
MD5Update(&ctx1, (const u_char *)final, MD5_SIZE);
400007dc: 00300a93 li s5,3
if(i % 3)
MD5Update(&ctx1, (const u_char *)sp, (u_int)sl);
400007e0: 00700a13 li s4,7
for(i = 0; i < 1000; i++) {
400007e4: 3e800993 li s3,1000
if(i & 1)
400007e8: 00147493 andi s1,s0,1
MD5Init(&ctx1);
400007ec: 07810513 addi a0,sp,120
400007f0: 721040ef jal ra,40005710 <MD5Init>
if(i & 1)
400007f4: 1a048463 beqz s1,4000099c <crypt_md5_r+0x3d8>
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
400007f8: 00090513 mv a0,s2
400007fc: 1641b0ef jal ra,4001b960 <strlen>
40000800: 00050613 mv a2,a0
40000804: 00090593 mv a1,s2
40000808: 07810513 addi a0,sp,120
4000080c: 741040ef jal ra,4000574c <MD5Update>
MD5Update(&ctx1, (const u_char *)final, MD5_SIZE);
40000810: 035477b3 remu a5,s0,s5
if(i % 3)
40000814: 1a079063 bnez a5,400009b4 <crypt_md5_r+0x3f0>
MD5Update(&ctx1, (const u_char *)sp, (u_int)sl);
40000818: 034477b3 remu a5,s0,s4
if(i % 7)
4000081c: 14079463 bnez a5,40000964 <crypt_md5_r+0x3a0>
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
if(i & 1)
40000820: 16048063 beqz s1,40000980 <crypt_md5_r+0x3bc>
MD5Update(&ctx1, (const u_char *)final, MD5_SIZE);
40000824: 01000613 li a2,16
40000828: 00010593 mv a1,sp
4000082c: 07810513 addi a0,sp,120
40000830: 71d040ef jal ra,4000574c <MD5Update>
for(i = 0; i < 1000; i++) {
40000834: 00140413 addi s0,s0,1
else
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
MD5Final(final, &ctx1);
40000838: 07810593 addi a1,sp,120
4000083c: 00010513 mv a0,sp
40000840: 010050ef jal ra,40005850 <MD5Final>
for(i = 0; i < 1000; i++) {
40000844: fb3412e3 bne s0,s3,400007e8 <crypt_md5_r+0x224>
}
p = passwd + strlen(passwd);
40000848: 000c0513 mv a0,s8
4000084c: 1141b0ef jal ra,4001b960 <strlen>
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12];
40000850: 00014783 lbu a5,0(sp)
40000854: 00614703 lbu a4,6(sp)
40000858: 00c14583 lbu a1,12(sp)
4000085c: 01079793 slli a5,a5,0x10
40000860: 00871713 slli a4,a4,0x8
p = passwd + strlen(passwd);
40000864: 00ac0433 add s0,s8,a0
l = (final[ 0]<<16) | (final[ 6]<<8) | final[12];
40000868: 00e7e7b3 or a5,a5,a4
_crypt_to64(p, l, 4); p += 4;
4000086c: 00b7e5b3 or a1,a5,a1
40000870: 00040513 mv a0,s0
40000874: 00400613 li a2,4
40000878: 7a5000ef jal ra,4000181c <_crypt_to64>
l = (final[ 1]<<16) | (final[ 7]<<8) | final[13];
4000087c: 00114783 lbu a5,1(sp)
40000880: 00714703 lbu a4,7(sp)
40000884: 00d14583 lbu a1,13(sp)
40000888: 01079793 slli a5,a5,0x10
4000088c: 00871713 slli a4,a4,0x8
40000890: 00e7e7b3 or a5,a5,a4
_crypt_to64(p, l, 4); p += 4;
40000894: 00b7e5b3 or a1,a5,a1
40000898: 00440513 addi a0,s0,4
4000089c: 00400613 li a2,4
400008a0: 77d000ef jal ra,4000181c <_crypt_to64>
l = (final[ 2]<<16) | (final[ 8]<<8) | final[14];
400008a4: 00214783 lbu a5,2(sp)
400008a8: 00814703 lbu a4,8(sp)
400008ac: 00e14583 lbu a1,14(sp)
400008b0: 01079793 slli a5,a5,0x10
400008b4: 00871713 slli a4,a4,0x8
400008b8: 00e7e7b3 or a5,a5,a4
_crypt_to64(p, l, 4); p += 4;
400008bc: 00b7e5b3 or a1,a5,a1
400008c0: 00840513 addi a0,s0,8
400008c4: 00400613 li a2,4
400008c8: 755000ef jal ra,4000181c <_crypt_to64>
l = (final[ 3]<<16) | (final[ 9]<<8) | final[15];
400008cc: 00314783 lbu a5,3(sp)
400008d0: 00914703 lbu a4,9(sp)
400008d4: 00f14583 lbu a1,15(sp)
400008d8: 01079793 slli a5,a5,0x10
400008dc: 00871713 slli a4,a4,0x8
400008e0: 00e7e7b3 or a5,a5,a4
_crypt_to64(p, l, 4); p += 4;
400008e4: 00b7e5b3 or a1,a5,a1
400008e8: 00c40513 addi a0,s0,12
400008ec: 00400613 li a2,4
400008f0: 72d000ef jal ra,4000181c <_crypt_to64>
l = (final[ 4]<<16) | (final[10]<<8) | final[ 5];
400008f4: 00414783 lbu a5,4(sp)
400008f8: 00a14703 lbu a4,10(sp)
400008fc: 00514583 lbu a1,5(sp)
40000900: 01079793 slli a5,a5,0x10
40000904: 00871713 slli a4,a4,0x8
40000908: 00e7e7b3 or a5,a5,a4
_crypt_to64(p, l, 4); p += 4;
4000090c: 00b7e5b3 or a1,a5,a1
40000910: 01040513 addi a0,s0,16
40000914: 00400613 li a2,4
40000918: 705000ef jal ra,4000181c <_crypt_to64>
l = final[11];
_crypt_to64(p, l, 2); p += 2;
4000091c: 00b14583 lbu a1,11(sp)
40000920: 01440513 addi a0,s0,20
40000924: 00200613 li a2,2
40000928: 6f5000ef jal ra,4000181c <_crypt_to64>
*p = '\0';
4000092c: 00040b23 sb zero,22(s0)
/* Don't leave anything around in vm they could use. */
memset(final, 0, sizeof(final));
return (passwd);
}
40000930: 10c12083 lw ra,268(sp)
40000934: 10812403 lw s0,264(sp)
40000938: 10412483 lw s1,260(sp)
4000093c: 10012903 lw s2,256(sp)
40000940: 0fc12983 lw s3,252(sp)
40000944: 0f812a03 lw s4,248(sp)
40000948: 0f412a83 lw s5,244(sp)
4000094c: 0f012b03 lw s6,240(sp)
40000950: 0ec12b83 lw s7,236(sp)
40000954: 000c0513 mv a0,s8
40000958: 0e812c03 lw s8,232(sp)
4000095c: 11010113 addi sp,sp,272
40000960: 00008067 ret
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
40000964: 00090513 mv a0,s2
40000968: 7f91a0ef jal ra,4001b960 <strlen>
4000096c: 00050613 mv a2,a0
40000970: 00090593 mv a1,s2
40000974: 07810513 addi a0,sp,120
40000978: 5d5040ef jal ra,4000574c <MD5Update>
if(i & 1)
4000097c: ea0494e3 bnez s1,40000824 <crypt_md5_r+0x260>
MD5Update(&ctx1, (const u_char *)pw, strlen(pw));
40000980: 00090513 mv a0,s2
40000984: 7dd1a0ef jal ra,4001b960 <strlen>
40000988: 00050613 mv a2,a0
4000098c: 00090593 mv a1,s2
40000990: 07810513 addi a0,sp,120
40000994: 5b9040ef jal ra,4000574c <MD5Update>
40000998: e9dff06f j 40000834 <crypt_md5_r+0x270>
MD5Update(&ctx1, (const u_char *)final, MD5_SIZE);
4000099c: 01000613 li a2,16
400009a0: 00010593 mv a1,sp
400009a4: 07810513 addi a0,sp,120
400009a8: 5a5040ef jal ra,4000574c <MD5Update>
400009ac: 035477b3 remu a5,s0,s5
if(i % 3)
400009b0: e60784e3 beqz a5,40000818 <crypt_md5_r+0x254>
MD5Update(&ctx1, (const u_char *)sp, (u_int)sl);
400009b4: 000b0613 mv a2,s6
400009b8: 000b8593 mv a1,s7
400009bc: 07810513 addi a0,sp,120
400009c0: 58d040ef jal ra,4000574c <MD5Update>
400009c4: e55ff06f j 40000818 <crypt_md5_r+0x254>
for(ep = sp; *ep && *ep != '$' && ep < (sp + 8); ep++)
400009c8: 00000b13 li s6,0 <== NOT EXECUTED
400009cc: c8dff06f j 40000658 <crypt_md5_r+0x94> <== NOT EXECUTED
4000053c <crypt_r>:
char *
crypt_r(const char *passwd, const char *salt, struct crypt_data *data)
{
4000053c: fe010113 addi sp,sp,-32
40000540: 01412423 sw s4,8(sp)
const struct crypt_format *cf;
SLIST_FOREACH(cf, &cf_head, link)
40000544: bac1aa03 lw s4,-1108(gp) # 40024e6c <cf_head>
{
40000548: 00912a23 sw s1,20(sp)
4000054c: 01212823 sw s2,16(sp)
40000550: 01312623 sw s3,12(sp)
40000554: 00112e23 sw ra,28(sp)
40000558: 00812c23 sw s0,24(sp)
4000055c: 00050913 mv s2,a0
40000560: 00058493 mv s1,a1
40000564: 00060993 mv s3,a2
SLIST_FOREACH(cf, &cf_head, link)
40000568: 020a0263 beqz s4,4000058c <crypt_r+0x50> <== NEVER TAKEN
4000056c: 000a0413 mv s0,s4
if (cf->magic != NULL && strstr(salt, cf->magic) == salt)
40000570: 00842583 lw a1,8(s0)
40000574: 00048513 mv a0,s1
40000578: 00058663 beqz a1,40000584 <crypt_r+0x48>
4000057c: 28d1b0ef jal ra,4001c008 <strstr>
40000580: 02a48e63 beq s1,a0,400005bc <crypt_r+0x80>
SLIST_FOREACH(cf, &cf_head, link)
40000584: 00042403 lw s0,0(s0)
40000588: fe0414e3 bnez s0,40000570 <crypt_r+0x34>
return (cf->func(passwd, salt, data));
cf = SLIST_FIRST(&cf_head);
return (cf->func(passwd, salt, data));
4000058c: 004a2783 lw a5,4(s4)
}
40000590: 01812403 lw s0,24(sp)
40000594: 01c12083 lw ra,28(sp)
40000598: 00812a03 lw s4,8(sp)
return (cf->func(passwd, salt, data));
4000059c: 00098613 mv a2,s3
400005a0: 00048593 mv a1,s1
}
400005a4: 00c12983 lw s3,12(sp)
400005a8: 01412483 lw s1,20(sp)
return (cf->func(passwd, salt, data));
400005ac: 00090513 mv a0,s2
}
400005b0: 01012903 lw s2,16(sp)
400005b4: 02010113 addi sp,sp,32
return (cf->func(passwd, salt, data));
400005b8: 00078067 jr a5
return (cf->func(passwd, salt, data));
400005bc: 00442783 lw a5,4(s0)
400005c0: fd1ff06f j 40000590 <crypt_r+0x54>
400009d0 <crypt_sha256_r>:
/* Maximum number of rounds. */
#define ROUNDS_MAX 999999999
char *
crypt_sha256_r(const char *key, const char *salt, struct crypt_data *data)
{
400009d0: e9010113 addi sp,sp,-368
400009d4: 16812423 sw s0,360(sp)
400009d8: 15312e23 sw s3,348(sp)
400009dc: 15512a23 sw s5,340(sp)
400009e0: 13b12e23 sw s11,316(sp)
400009e4: 16112623 sw ra,364(sp)
400009e8: 16912223 sw s1,356(sp)
400009ec: 17212023 sw s2,352(sp)
400009f0: 15412c23 sw s4,344(sp)
400009f4: 15612823 sw s6,336(sp)
400009f8: 15712623 sw s7,332(sp)
400009fc: 15812423 sw s8,328(sp)
40000a00: 15912223 sw s9,324(sp)
40000a04: 15a12023 sw s10,320(sp)
40000a08: 17010413 addi s0,sp,368
rounds = ROUNDS_DEFAULT;
rounds_custom = false;
/* Find beginning of salt string. The prefix should normally always
* be present. Just in case it is not. */
if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0)
40000a0c: 0005c703 lbu a4,0(a1)
int buflen = (int)sizeof(data->buffer);
40000a10: 10000793 li a5,256
40000a14: eaf42623 sw a5,-340(s0)
if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0)
40000a18: 02400793 li a5,36
{
40000a1c: 00058a93 mv s5,a1
40000a20: 00050993 mv s3,a0
40000a24: 00060d93 mv s11,a2
if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0)
40000a28: 00e79863 bne a5,a4,40000a38 <crypt_sha256_r+0x68>
40000a2c: 0015c703 lbu a4,1(a1)
40000a30: 03500693 li a3,53
40000a34: 50e68a63 beq a3,a4,40000f48 <crypt_sha256_r+0x578>
/* Skip salt prefix. */
salt += sizeof(sha256_salt_prefix) - 1;
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1)
40000a38: 00700613 li a2,7 <== NOT EXECUTED
40000a3c: b5818593 addi a1,gp,-1192 # 40024e18 <sha256_rounds_prefix> <== NOT EXECUTED
40000a40: 000a8513 mv a0,s5 <== NOT EXECUTED
40000a44: 0381b0ef jal ra,4001ba7c <strncmp> <== NOT EXECUTED
40000a48: 52050063 beqz a0,40000f68 <crypt_sha256_r+0x598> <== NOT EXECUTED
rounds = ROUNDS_DEFAULT;
40000a4c: 00001bb7 lui s7,0x1
rounds_custom = false;
40000a50: e8042e23 sw zero,-356(s0)
rounds = ROUNDS_DEFAULT;
40000a54: 388b8b93 addi s7,s7,904 # 1388 <_ISR_Stack_size+0x388>
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
rounds_custom = true;
}
}
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
40000a58: 400235b7 lui a1,0x40023
40000a5c: 8a458593 addi a1,a1,-1884 # 400228a4 <test_cases_sha512+0x58>
40000a60: 000a8513 mv a0,s5
40000a64: 6291a0ef jal ra,4001b88c <strcspn>
40000a68: 00f00793 li a5,15
40000a6c: 00050a13 mv s4,a0
40000a70: 00a7f463 bgeu a5,a0,40000a78 <crypt_sha256_r+0xa8>
40000a74: 01000a13 li s4,16
key_len = strlen(key);
40000a78: 00098513 mv a0,s3
40000a7c: 6e51a0ef jal ra,4001b960 <strlen>
40000a80: 00050913 mv s2,a0
/* Prepare for the real work. */
SHA256_Init(&ctx);
40000a84: ef040513 addi a0,s0,-272
40000a88: 750070ef jal ra,400081d8 <SHA256_Init>
/* Add the key string. */
SHA256_Update(&ctx, key, key_len);
40000a8c: 00090613 mv a2,s2
40000a90: 00098593 mv a1,s3
40000a94: ef040513 addi a0,s0,-272
40000a98: 7b4070ef jal ra,4000824c <SHA256_Update>
/* The last part is the salt string. This must be at most 8
* characters and it ends at the first `$' character (for
* compatibility with existing implementations). */
SHA256_Update(&ctx, salt, salt_len);
40000a9c: 000a0613 mv a2,s4
40000aa0: 000a8593 mv a1,s5
40000aa4: ef040513 addi a0,s0,-272
40000aa8: 7a4070ef jal ra,4000824c <SHA256_Update>
/* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The
* final result will be added to the first context. */
SHA256_Init(&alt_ctx);
40000aac: f5840513 addi a0,s0,-168
40000ab0: 728070ef jal ra,400081d8 <SHA256_Init>
/* Add key. */
SHA256_Update(&alt_ctx, key, key_len);
40000ab4: 00090613 mv a2,s2
40000ab8: 00098593 mv a1,s3
40000abc: f5840513 addi a0,s0,-168
40000ac0: 78c070ef jal ra,4000824c <SHA256_Update>
/* Add salt. */
SHA256_Update(&alt_ctx, salt, salt_len);
40000ac4: 000a0613 mv a2,s4
40000ac8: 000a8593 mv a1,s5
40000acc: f5840513 addi a0,s0,-168
40000ad0: 77c070ef jal ra,4000824c <SHA256_Update>
/* Add key again. */
SHA256_Update(&alt_ctx, key, key_len);
40000ad4: 00090613 mv a2,s2
40000ad8: 00098593 mv a1,s3
40000adc: f5840513 addi a0,s0,-168
40000ae0: 76c070ef jal ra,4000824c <SHA256_Update>
/* Now get result of this (32 bytes) and add it to the other context. */
SHA256_Final(alt_result, &alt_ctx);
40000ae4: f5840593 addi a1,s0,-168
40000ae8: eb040513 addi a0,s0,-336
40000aec: 05d070ef jal ra,40008348 <SHA256_Final>
/* Add for any character in the key one byte of the alternate sum. */
for (cnt = key_len; cnt > 32; cnt -= 32)
40000af0: 02000793 li a5,32
40000af4: 5127fa63 bgeu a5,s2,40001008 <crypt_sha256_r+0x638>
40000af8: 00090493 mv s1,s2
SHA256_Update(&ctx, alt_result, 32);
40000afc: 02000613 li a2,32
40000b00: eb040593 addi a1,s0,-336
40000b04: ef040513 addi a0,s0,-272
40000b08: 744070ef jal ra,4000824c <SHA256_Update>
for (cnt = key_len; cnt > 32; cnt -= 32)
40000b0c: fe048493 addi s1,s1,-32
40000b10: 02000793 li a5,32
40000b14: fe97e4e3 bltu a5,s1,40000afc <crypt_sha256_r+0x12c>
40000b18: fdf90793 addi a5,s2,-33
40000b1c: fe07f793 andi a5,a5,-32
40000b20: fe090613 addi a2,s2,-32
SHA256_Update(&ctx, alt_result, cnt);
40000b24: 40f60633 sub a2,a2,a5
40000b28: eb040593 addi a1,s0,-336
40000b2c: ef040513 addi a0,s0,-272
40000b30: 71c070ef jal ra,4000824c <SHA256_Update>
key_len = strlen(key);
40000b34: 00090493 mv s1,s2
/* Take the binary representation of the length of the key and for
* every 1 add the alternate sum, for every 0 the key. */
for (cnt = key_len; cnt > 0; cnt >>= 1)
if ((cnt & 1) != 0)
40000b38: 0014f793 andi a5,s1,1
SHA256_Update(&ctx, alt_result, 32);
40000b3c: 02000613 li a2,32
40000b40: eb040593 addi a1,s0,-336
40000b44: ef040513 addi a0,s0,-272
if ((cnt & 1) != 0)
40000b48: 00079863 bnez a5,40000b58 <crypt_sha256_r+0x188>
else
SHA256_Update(&ctx, key, key_len);
40000b4c: 00090613 mv a2,s2
40000b50: 00098593 mv a1,s3
40000b54: ef040513 addi a0,s0,-272
for (cnt = key_len; cnt > 0; cnt >>= 1)
40000b58: 0014d493 srli s1,s1,0x1
SHA256_Update(&ctx, key, key_len);
40000b5c: 6f0070ef jal ra,4000824c <SHA256_Update>
for (cnt = key_len; cnt > 0; cnt >>= 1)
40000b60: fc049ce3 bnez s1,40000b38 <crypt_sha256_r+0x168>
/* Create intermediate result. */
SHA256_Final(alt_result, &ctx);
40000b64: eb040513 addi a0,s0,-336
40000b68: ef040593 addi a1,s0,-272
40000b6c: 7dc070ef jal ra,40008348 <SHA256_Final>
/* Start computation of P byte sequence. */
SHA256_Init(&alt_ctx);
40000b70: f5840513 addi a0,s0,-168
40000b74: 664070ef jal ra,400081d8 <SHA256_Init>
/* For every character in the password add the entire password. */
for (cnt = 0; cnt < key_len; ++cnt)
40000b78: 00148493 addi s1,s1,1
SHA256_Update(&alt_ctx, key, key_len);
40000b7c: 00090613 mv a2,s2
40000b80: 00098593 mv a1,s3
40000b84: f5840513 addi a0,s0,-168
40000b88: 6c4070ef jal ra,4000824c <SHA256_Update>
for (cnt = 0; cnt < key_len; ++cnt)
40000b8c: ff24e6e3 bltu s1,s2,40000b78 <crypt_sha256_r+0x1a8>
/* Finish the digest. */
SHA256_Final(temp_result, &alt_ctx);
40000b90: ed040493 addi s1,s0,-304
40000b94: 00048513 mv a0,s1
40000b98: f5840593 addi a1,s0,-168
40000b9c: 7ac070ef jal ra,40008348 <SHA256_Final>
/* Create byte sequence P. */
cp = p_bytes = alloca(key_len);
40000ba0: 01790793 addi a5,s2,23
40000ba4: ff07f793 andi a5,a5,-16
40000ba8: 40f10133 sub sp,sp,a5
40000bac: 00f10b13 addi s6,sp,15
40000bb0: ff0b7b13 andi s6,s6,-16
40000bb4: eb642223 sw s6,-348(s0)
for (cnt = key_len; cnt >= 32; cnt -= 32) {
40000bb8: 01f00793 li a5,31
40000bbc: 000b0513 mv a0,s6
40000bc0: 4927fa63 bgeu a5,s2,40001054 <crypt_sha256_r+0x684>
40000bc4: 00090c13 mv s8,s2
40000bc8: 01f00993 li s3,31
memcpy(cp, temp_result, 32);
40000bcc: 02000613 li a2,32
40000bd0: 00048593 mv a1,s1
40000bd4: 5501a0ef jal ra,4001b124 <memcpy>
cp += 32;
40000bd8: ea442503 lw a0,-348(s0)
for (cnt = key_len; cnt >= 32; cnt -= 32) {
40000bdc: fe0c0c13 addi s8,s8,-32
cp += 32;
40000be0: 02050513 addi a0,a0,32
40000be4: eaa42223 sw a0,-348(s0)
for (cnt = key_len; cnt >= 32; cnt -= 32) {
40000be8: ff89e2e3 bltu s3,s8,40000bcc <crypt_sha256_r+0x1fc>
40000bec: 01f97613 andi a2,s2,31
}
memcpy(cp, temp_result, cnt);
40000bf0: 00048593 mv a1,s1
40000bf4: 5301a0ef jal ra,4001b124 <memcpy>
/* Start computation of S byte sequence. */
SHA256_Init(&alt_ctx);
40000bf8: f5840513 addi a0,s0,-168
40000bfc: 5dc070ef jal ra,400081d8 <SHA256_Init>
/* For every character in the password add the entire password. */
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
40000c00: 00000993 li s3,0
SHA256_Update(&alt_ctx, salt, salt_len);
40000c04: 000a0613 mv a2,s4
40000c08: 000a8593 mv a1,s5
40000c0c: f5840513 addi a0,s0,-168
40000c10: 63c070ef jal ra,4000824c <SHA256_Update>
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
40000c14: eb044783 lbu a5,-336(s0)
40000c18: 00198993 addi s3,s3,1
40000c1c: 01078793 addi a5,a5,16
40000c20: fef9e2e3 bltu s3,a5,40000c04 <crypt_sha256_r+0x234>
/* Finish the digest. */
SHA256_Final(temp_result, &alt_ctx);
40000c24: 00048513 mv a0,s1
40000c28: f5840593 addi a1,s0,-168
40000c2c: 71c070ef jal ra,40008348 <SHA256_Final>
/* Create byte sequence S. */
cp = s_bytes = alloca(salt_len);
40000c30: 017a0793 addi a5,s4,23
40000c34: ff07f793 andi a5,a5,-16
40000c38: 40f10133 sub sp,sp,a5
40000c3c: 00f10d13 addi s10,sp,15
40000c40: ff0d7d13 andi s10,s10,-16
for (cnt = salt_len; cnt >= 32; cnt -= 32) {
memcpy(cp, temp_result, 32);
cp += 32;
}
memcpy(cp, temp_result, cnt);
40000c44: 00048593 mv a1,s1
40000c48: 000a0613 mv a2,s4
40000c4c: 000d0513 mv a0,s10
cp = s_bytes = alloca(salt_len);
40000c50: eba42223 sw s10,-348(s0)
/* Repeatedly run the collected hash value through SHA256 to burn CPU
* cycles. */
for (cnt = 0; cnt < rounds; ++cnt) {
40000c54: 00000493 li s1,0
memcpy(cp, temp_result, cnt);
40000c58: 4cc1a0ef jal ra,4001b124 <memcpy>
/* Add key or last result. */
if ((cnt & 1) != 0)
SHA256_Update(&ctx, p_bytes, key_len);
else
SHA256_Update(&ctx, alt_result, 32);
40000c5c: 00300c93 li s9,3
/* Add salt for numbers not divisible by 3. */
if (cnt % 3 != 0)
SHA256_Update(&ctx, s_bytes, salt_len);
40000c60: 00700c13 li s8,7
if ((cnt & 1) != 0)
40000c64: 0014f993 andi s3,s1,1
SHA256_Init(&ctx);
40000c68: ef040513 addi a0,s0,-272
40000c6c: 56c070ef jal ra,400081d8 <SHA256_Init>
if ((cnt & 1) != 0)
40000c70: 2a098663 beqz s3,40000f1c <crypt_sha256_r+0x54c>
SHA256_Update(&ctx, p_bytes, key_len);
40000c74: 00090613 mv a2,s2
40000c78: 000b0593 mv a1,s6
40000c7c: ef040513 addi a0,s0,-272
40000c80: 5cc070ef jal ra,4000824c <SHA256_Update>
SHA256_Update(&ctx, alt_result, 32);
40000c84: 0394f7b3 remu a5,s1,s9
if (cnt % 3 != 0)
40000c88: 2a079663 bnez a5,40000f34 <crypt_sha256_r+0x564>
SHA256_Update(&ctx, s_bytes, salt_len);
40000c8c: 0384f7b3 remu a5,s1,s8
/* Add key for numbers not divisible by 7. */
if (cnt % 7 != 0)
40000c90: 26079263 bnez a5,40000ef4 <crypt_sha256_r+0x524>
SHA256_Update(&ctx, p_bytes, key_len);
/* Add key or last result. */
if ((cnt & 1) != 0)
40000c94: 26098a63 beqz s3,40000f08 <crypt_sha256_r+0x538>
SHA256_Update(&ctx, alt_result, 32);
40000c98: 02000613 li a2,32
40000c9c: eb040593 addi a1,s0,-336
40000ca0: ef040513 addi a0,s0,-272
40000ca4: 5a8070ef jal ra,4000824c <SHA256_Update>
for (cnt = 0; cnt < rounds; ++cnt) {
40000ca8: 00148493 addi s1,s1,1
else
SHA256_Update(&ctx, p_bytes, key_len);
/* Create intermediate result. */
SHA256_Final(alt_result, &ctx);
40000cac: ef040593 addi a1,s0,-272
40000cb0: eb040513 addi a0,s0,-336
40000cb4: 694070ef jal ra,40008348 <SHA256_Final>
for (cnt = 0; cnt < rounds; ++cnt) {
40000cb8: fa9b96e3 bne s7,s1,40000c64 <crypt_sha256_r+0x294>
}
/* Now we can construct the result string. It consists of three
* parts. */
cp = stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen));
40000cbc: eac42483 lw s1,-340(s0)
40000cc0: b6018593 addi a1,gp,-1184 # 40024e20 <sha256_salt_prefix>
40000cc4: fff4c613 not a2,s1
40000cc8: 41f65613 srai a2,a2,0x1f
40000ccc: 00c4f633 and a2,s1,a2
40000cd0: 000d8513 mv a0,s11
40000cd4: 0e91a0ef jal ra,4001b5bc <stpncpy>
buflen -= sizeof(sha256_salt_prefix) - 1;
40000cd8: ffd48493 addi s1,s1,-3
if (rounds_custom) {
40000cdc: e9c42703 lw a4,-356(s0)
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
40000ce0: fff4c593 not a1,s1
40000ce4: 41f5d593 srai a1,a1,0x1f
cp = stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen));
40000ce8: eaa42223 sw a0,-348(s0)
buflen -= sizeof(sha256_salt_prefix) - 1;
40000cec: ea942623 sw s1,-340(s0)
cp = stpncpy(buffer, sha256_salt_prefix, MAX(0, buflen));
40000cf0: 00050793 mv a5,a0
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
40000cf4: 00b4f5b3 and a1,s1,a1
if (rounds_custom) {
40000cf8: 2c071063 bnez a4,40000fb8 <crypt_sha256_r+0x5e8>
cp += n;
buflen -= n;
}
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40000cfc: 000a0613 mv a2,s4
40000d00: 0145f463 bgeu a1,s4,40000d08 <crypt_sha256_r+0x338>
40000d04: 00058613 mv a2,a1 <== NOT EXECUTED
40000d08: 00078513 mv a0,a5
40000d0c: 000a8593 mv a1,s5
40000d10: 0ad1a0ef jal ra,4001b5bc <stpncpy>
buflen -= MIN((size_t)MAX(0, buflen), salt_len);
40000d14: eac42783 lw a5,-340(s0)
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40000d18: eaa42223 sw a0,-348(s0)
buflen -= MIN((size_t)MAX(0, buflen), salt_len);
40000d1c: 00000713 li a4,0
40000d20: 0007c863 bltz a5,40000d30 <crypt_sha256_r+0x360> <== NEVER TAKEN
40000d24: 00078713 mv a4,a5
40000d28: 00fa7463 bgeu s4,a5,40000d30 <crypt_sha256_r+0x360>
40000d2c: 000a0713 mv a4,s4
40000d30: 40e787b3 sub a5,a5,a4
40000d34: eaf42623 sw a5,-340(s0)
if (buflen > 0) {
40000d38: 02f05063 blez a5,40000d58 <crypt_sha256_r+0x388> <== NEVER TAKEN
*cp++ = '$';
40000d3c: 00150793 addi a5,a0,1
40000d40: eaf42223 sw a5,-348(s0)
40000d44: 02400793 li a5,36
40000d48: 00f50023 sb a5,0(a0)
--buflen;
40000d4c: eac42783 lw a5,-340(s0)
40000d50: fff78793 addi a5,a5,-1
40000d54: eaf42623 sw a5,-340(s0)
}
b64_from_24bit(alt_result[0], alt_result[10], alt_result[20], 4, &buflen, &cp);
40000d58: ec444603 lbu a2,-316(s0)
40000d5c: eba44583 lbu a1,-326(s0)
40000d60: eb044503 lbu a0,-336(s0)
40000d64: 00400693 li a3,4
40000d68: ea440793 addi a5,s0,-348
40000d6c: eac40713 addi a4,s0,-340
40000d70: 2dd000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[21], alt_result[1], alt_result[11], 4, &buflen, &cp);
40000d74: ebb44603 lbu a2,-325(s0)
40000d78: eb144583 lbu a1,-335(s0)
40000d7c: ec544503 lbu a0,-315(s0)
40000d80: ea440793 addi a5,s0,-348
40000d84: eac40713 addi a4,s0,-340
40000d88: 00400693 li a3,4
40000d8c: 2c1000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[12], alt_result[22], alt_result[2], 4, &buflen, &cp);
40000d90: eb244603 lbu a2,-334(s0)
40000d94: ec644583 lbu a1,-314(s0)
40000d98: ebc44503 lbu a0,-324(s0)
40000d9c: ea440793 addi a5,s0,-348
40000da0: eac40713 addi a4,s0,-340
40000da4: 00400693 li a3,4
40000da8: 2a5000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[3], alt_result[13], alt_result[23], 4, &buflen, &cp);
40000dac: ec744603 lbu a2,-313(s0)
40000db0: ebd44583 lbu a1,-323(s0)
40000db4: eb344503 lbu a0,-333(s0)
40000db8: ea440793 addi a5,s0,-348
40000dbc: eac40713 addi a4,s0,-340
40000dc0: 00400693 li a3,4
40000dc4: 289000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[24], alt_result[4], alt_result[14], 4, &buflen, &cp);
40000dc8: ebe44603 lbu a2,-322(s0)
40000dcc: eb444583 lbu a1,-332(s0)
40000dd0: ec844503 lbu a0,-312(s0)
40000dd4: ea440793 addi a5,s0,-348
40000dd8: eac40713 addi a4,s0,-340
40000ddc: 00400693 li a3,4
40000de0: 26d000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[15], alt_result[25], alt_result[5], 4, &buflen, &cp);
40000de4: eb544603 lbu a2,-331(s0)
40000de8: ec944583 lbu a1,-311(s0)
40000dec: ebf44503 lbu a0,-321(s0)
40000df0: ea440793 addi a5,s0,-348
40000df4: eac40713 addi a4,s0,-340
40000df8: 00400693 li a3,4
40000dfc: 251000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[6], alt_result[16], alt_result[26], 4, &buflen, &cp);
40000e00: eca44603 lbu a2,-310(s0)
40000e04: ec044583 lbu a1,-320(s0)
40000e08: eb644503 lbu a0,-330(s0)
40000e0c: ea440793 addi a5,s0,-348
40000e10: eac40713 addi a4,s0,-340
40000e14: 00400693 li a3,4
40000e18: 235000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[27], alt_result[7], alt_result[17], 4, &buflen, &cp);
40000e1c: ec144603 lbu a2,-319(s0)
40000e20: eb744583 lbu a1,-329(s0)
40000e24: ecb44503 lbu a0,-309(s0)
40000e28: ea440793 addi a5,s0,-348
40000e2c: eac40713 addi a4,s0,-340
40000e30: 00400693 li a3,4
40000e34: 219000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[18], alt_result[28], alt_result[8], 4, &buflen, &cp);
40000e38: eb844603 lbu a2,-328(s0)
40000e3c: ecc44583 lbu a1,-308(s0)
40000e40: ec244503 lbu a0,-318(s0)
40000e44: ea440793 addi a5,s0,-348
40000e48: eac40713 addi a4,s0,-340
40000e4c: 00400693 li a3,4
40000e50: 1fd000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[9], alt_result[19], alt_result[29], 4, &buflen, &cp);
40000e54: ecd44603 lbu a2,-307(s0)
40000e58: ec344583 lbu a1,-317(s0)
40000e5c: eb944503 lbu a0,-327(s0)
40000e60: ea440793 addi a5,s0,-348
40000e64: eac40713 addi a4,s0,-340
40000e68: 00400693 li a3,4
40000e6c: 1e1000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(0, alt_result[31], alt_result[30], 3, &buflen, &cp);
40000e70: ece44603 lbu a2,-306(s0)
40000e74: ecf44583 lbu a1,-305(s0)
40000e78: ea440793 addi a5,s0,-348
40000e7c: eac40713 addi a4,s0,-340
40000e80: 00300693 li a3,3
40000e84: 00000513 li a0,0
40000e88: 1c5000ef jal ra,4000184c <_crypt_b64_from_24bit>
if (buflen <= 0) {
40000e8c: eac42783 lw a5,-340(s0)
40000e90: 16f05263 blez a5,40000ff4 <crypt_sha256_r+0x624> <== NEVER TAKEN
errno = ERANGE;
buffer = NULL;
}
else
*cp = '\0'; /* Terminate the string. */
40000e94: ea442783 lw a5,-348(s0)
40000e98: 00078023 sb zero,0(a5)
/* Clear the buffer for the intermediate result so that people
* attaching to processes or reading core dumps cannot get any
* information. We do it in this way to clear correct_words[] inside
* the SHA256 implementation as well. */
SHA256_Init(&ctx);
40000e9c: ef040513 addi a0,s0,-272
40000ea0: 338070ef jal ra,400081d8 <SHA256_Init>
SHA256_Final(alt_result, &ctx);
40000ea4: eb040513 addi a0,s0,-336
40000ea8: ef040593 addi a1,s0,-272
40000eac: 49c070ef jal ra,40008348 <SHA256_Final>
memset(copied_key, '\0', key_len);
if (copied_salt != NULL)
memset(copied_salt, '\0', salt_len);
return buffer;
}
40000eb0: e9040113 addi sp,s0,-368
40000eb4: 16c12083 lw ra,364(sp)
40000eb8: 000d8513 mv a0,s11
40000ebc: 16812403 lw s0,360(sp)
40000ec0: 16412483 lw s1,356(sp)
40000ec4: 16012903 lw s2,352(sp)
40000ec8: 15c12983 lw s3,348(sp)
40000ecc: 15812a03 lw s4,344(sp)
40000ed0: 15412a83 lw s5,340(sp)
40000ed4: 15012b03 lw s6,336(sp)
40000ed8: 14c12b83 lw s7,332(sp)
40000edc: 14812c03 lw s8,328(sp)
40000ee0: 14412c83 lw s9,324(sp)
40000ee4: 14012d03 lw s10,320(sp)
40000ee8: 13c12d83 lw s11,316(sp)
40000eec: 17010113 addi sp,sp,368
40000ef0: 00008067 ret
SHA256_Update(&ctx, p_bytes, key_len);
40000ef4: 00090613 mv a2,s2
40000ef8: 000b0593 mv a1,s6
40000efc: ef040513 addi a0,s0,-272
40000f00: 34c070ef jal ra,4000824c <SHA256_Update>
if ((cnt & 1) != 0)
40000f04: d8099ae3 bnez s3,40000c98 <crypt_sha256_r+0x2c8>
SHA256_Update(&ctx, p_bytes, key_len);
40000f08: 00090613 mv a2,s2
40000f0c: 000b0593 mv a1,s6
40000f10: ef040513 addi a0,s0,-272
40000f14: 338070ef jal ra,4000824c <SHA256_Update>
40000f18: d91ff06f j 40000ca8 <crypt_sha256_r+0x2d8>
SHA256_Update(&ctx, alt_result, 32);
40000f1c: 02000613 li a2,32
40000f20: eb040593 addi a1,s0,-336
40000f24: ef040513 addi a0,s0,-272
40000f28: 324070ef jal ra,4000824c <SHA256_Update>
40000f2c: 0394f7b3 remu a5,s1,s9
if (cnt % 3 != 0)
40000f30: d4078ee3 beqz a5,40000c8c <crypt_sha256_r+0x2bc>
SHA256_Update(&ctx, s_bytes, salt_len);
40000f34: 000a0613 mv a2,s4
40000f38: 000d0593 mv a1,s10
40000f3c: ef040513 addi a0,s0,-272
40000f40: 30c070ef jal ra,4000824c <SHA256_Update>
40000f44: d49ff06f j 40000c8c <crypt_sha256_r+0x2bc>
if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0)
40000f48: 0025c703 lbu a4,2(a1)
40000f4c: aee796e3 bne a5,a4,40000a38 <crypt_sha256_r+0x68>
salt += sizeof(sha256_salt_prefix) - 1;
40000f50: 00358a93 addi s5,a1,3
if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1)
40000f54: 00700613 li a2,7
40000f58: b5818593 addi a1,gp,-1192 # 40024e18 <sha256_rounds_prefix>
40000f5c: 000a8513 mv a0,s5
40000f60: 31d1a0ef jal ra,4001ba7c <strncmp>
40000f64: ae0514e3 bnez a0,40000a4c <crypt_sha256_r+0x7c>
srounds = strtoul(num, &endp, 10);
40000f68: 00a00613 li a2,10
40000f6c: ea840593 addi a1,s0,-344
40000f70: 007a8513 addi a0,s5,7
40000f74: 5041b0ef jal ra,4001c478 <strtoul>
if (*endp == '$') {
40000f78: ea842783 lw a5,-344(s0)
40000f7c: 02400713 li a4,36
40000f80: 0007c683 lbu a3,0(a5)
40000f84: ace694e3 bne a3,a4,40000a4c <crypt_sha256_r+0x7c>
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
40000f88: 3b9ad737 lui a4,0x3b9ad
40000f8c: 9ff70713 addi a4,a4,-1537 # 3b9ac9ff <RamSize+0x3a9ac9ff>
40000f90: 00050b93 mv s7,a0
salt = endp + 1;
40000f94: 00178a93 addi s5,a5,1
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
40000f98: 00a77463 bgeu a4,a0,40000fa0 <crypt_sha256_r+0x5d0>
40000f9c: 00070b93 mv s7,a4 <== NOT EXECUTED
40000fa0: 3e800793 li a5,1000
40000fa4: 00fbf463 bgeu s7,a5,40000fac <crypt_sha256_r+0x5dc>
40000fa8: 3e800b93 li s7,1000
rounds_custom = true;
40000fac: 00100793 li a5,1
40000fb0: e8f42e23 sw a5,-356(s0)
40000fb4: aa5ff06f j 40000a58 <crypt_sha256_r+0x88>
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
40000fb8: 40023637 lui a2,0x40023
40000fbc: b5818693 addi a3,gp,-1192 # 40024e18 <sha256_rounds_prefix>
40000fc0: 000b8713 mv a4,s7
40000fc4: 8a860613 addi a2,a2,-1880 # 400228a8 <test_cases_sha512+0x5c>
40000fc8: 4ec1a0ef jal ra,4001b4b4 <snprintf>
buflen -= n;
40000fcc: eac42583 lw a1,-340(s0)
cp += n;
40000fd0: ea442783 lw a5,-348(s0)
buflen -= n;
40000fd4: 40a584b3 sub s1,a1,a0
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40000fd8: fff4c593 not a1,s1
cp += n;
40000fdc: 00a787b3 add a5,a5,a0
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40000fe0: 41f5d593 srai a1,a1,0x1f
cp += n;
40000fe4: eaf42223 sw a5,-348(s0)
buflen -= n;
40000fe8: ea942623 sw s1,-340(s0)
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40000fec: 00b4f5b3 and a1,s1,a1
40000ff0: d0dff06f j 40000cfc <crypt_sha256_r+0x32c>
errno = ERANGE;
40000ff4: 0041a0ef jal ra,4001aff8 <__errno> <== NOT EXECUTED
40000ff8: 02200793 li a5,34 <== NOT EXECUTED
40000ffc: 00f52023 sw a5,0(a0) <== NOT EXECUTED
buffer = NULL;
40001000: 00000d93 li s11,0 <== NOT EXECUTED
40001004: e99ff06f j 40000e9c <crypt_sha256_r+0x4cc> <== NOT EXECUTED
SHA256_Update(&ctx, alt_result, cnt);
40001008: 00090613 mv a2,s2
4000100c: eb040593 addi a1,s0,-336
40001010: ef040513 addi a0,s0,-272
40001014: 238070ef jal ra,4000824c <SHA256_Update>
for (cnt = key_len; cnt > 0; cnt >>= 1)
40001018: b0091ee3 bnez s2,40000b34 <crypt_sha256_r+0x164> <== ALWAYS TAKEN
SHA256_Final(alt_result, &ctx);
4000101c: ef040593 addi a1,s0,-272 <== NOT EXECUTED
40001020: eb040513 addi a0,s0,-336 <== NOT EXECUTED
40001024: 324070ef jal ra,40008348 <SHA256_Final> <== NOT EXECUTED
SHA256_Init(&alt_ctx);
40001028: f5840513 addi a0,s0,-168 <== NOT EXECUTED
4000102c: 1ac070ef jal ra,400081d8 <SHA256_Init> <== NOT EXECUTED
SHA256_Final(temp_result, &alt_ctx);
40001030: ed040493 addi s1,s0,-304 <== NOT EXECUTED
40001034: 00048513 mv a0,s1 <== NOT EXECUTED
40001038: f5840593 addi a1,s0,-168 <== NOT EXECUTED
4000103c: 30c070ef jal ra,40008348 <SHA256_Final> <== NOT EXECUTED
cp = p_bytes = alloca(key_len);
40001040: 00010b13 mv s6,sp <== NOT EXECUTED
40001044: ea242223 sw sp,-348(s0) <== NOT EXECUTED
40001048: 00010513 mv a0,sp <== NOT EXECUTED
4000104c: 00000613 li a2,0 <== NOT EXECUTED
40001050: ba1ff06f j 40000bf0 <crypt_sha256_r+0x220> <== NOT EXECUTED
for (cnt = key_len; cnt >= 32; cnt -= 32) {
40001054: 00090613 mv a2,s2
40001058: b99ff06f j 40000bf0 <crypt_sha256_r+0x220>
4000105c <crypt_sha512_r>:
/* Maximum number of rounds. */
#define ROUNDS_MAX 999999999
char *
crypt_sha512_r(const char *key, const char *salt, struct crypt_data *data)
{
4000105c: d8010113 addi sp,sp,-640
40001060: 26812c23 sw s0,632(sp)
40001064: 27312623 sw s3,620(sp)
40001068: 27512223 sw s5,612(sp)
4000106c: 25b12623 sw s11,588(sp)
40001070: 26112e23 sw ra,636(sp)
40001074: 26912a23 sw s1,628(sp)
40001078: 27212823 sw s2,624(sp)
4000107c: 27412423 sw s4,616(sp)
40001080: 27612023 sw s6,608(sp)
40001084: 25712e23 sw s7,604(sp)
40001088: 25812c23 sw s8,600(sp)
4000108c: 25912a23 sw s9,596(sp)
40001090: 25a12823 sw s10,592(sp)
40001094: 28010413 addi s0,sp,640
rounds = ROUNDS_DEFAULT;
rounds_custom = false;
/* Find beginning of salt string. The prefix should normally always
* be present. Just in case it is not. */
if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0)
40001098: 0005c703 lbu a4,0(a1)
int buflen = (int)sizeof(data->buffer);
4000109c: 10000793 li a5,256
400010a0: d8f42e23 sw a5,-612(s0)
if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0)
400010a4: 02400793 li a5,36
{
400010a8: 00058a93 mv s5,a1
400010ac: 00050993 mv s3,a0
400010b0: 00060d93 mv s11,a2
if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0)
400010b4: 00e79863 bne a5,a4,400010c4 <crypt_sha512_r+0x68>
400010b8: 0015c703 lbu a4,1(a1)
400010bc: 03600693 li a3,54
400010c0: 64e68463 beq a3,a4,40001708 <crypt_sha512_r+0x6ac>
/* Skip salt prefix. */
salt += sizeof(sha512_salt_prefix) - 1;
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1)
400010c4: 00700613 li a2,7
400010c8: b6418593 addi a1,gp,-1180 # 40024e24 <sha512_rounds_prefix>
400010cc: 000a8513 mv a0,s5
400010d0: 1ad1a0ef jal ra,4001ba7c <strncmp>
400010d4: 64050a63 beqz a0,40001728 <crypt_sha512_r+0x6cc> <== NEVER TAKEN
rounds = ROUNDS_DEFAULT;
400010d8: 00001bb7 lui s7,0x1
rounds_custom = false;
400010dc: d8042623 sw zero,-628(s0)
rounds = ROUNDS_DEFAULT;
400010e0: 388b8b93 addi s7,s7,904 # 1388 <_ISR_Stack_size+0x388>
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
rounds_custom = true;
}
}
salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
400010e4: 400235b7 lui a1,0x40023
400010e8: 8a458593 addi a1,a1,-1884 # 400228a4 <test_cases_sha512+0x58>
400010ec: 000a8513 mv a0,s5
400010f0: 79c1a0ef jal ra,4001b88c <strcspn>
400010f4: 00f00793 li a5,15
400010f8: 00050a13 mv s4,a0
400010fc: 00a7f463 bgeu a5,a0,40001104 <crypt_sha512_r+0xa8>
40001100: 01000a13 li s4,16
key_len = strlen(key);
40001104: 00098513 mv a0,s3
40001108: 0591a0ef jal ra,4001b960 <strlen>
4000110c: 00050913 mv s2,a0
/* Prepare for the real work. */
SHA512_Init(&ctx);
40001110: e2040513 addi a0,s0,-480
40001114: 118100ef jal ra,4001122c <SHA512_Init>
/* Add the key string. */
SHA512_Update(&ctx, key, key_len);
40001118: 00090613 mv a2,s2
4000111c: 00098593 mv a1,s3
40001120: e2040513 addi a0,s0,-480
40001124: 1a4100ef jal ra,400112c8 <SHA512_Update>
/* The last part is the salt string. This must be at most 8
* characters and it ends at the first `$' character (for
* compatibility with existing implementations). */
SHA512_Update(&ctx, salt, salt_len);
40001128: 000a0613 mv a2,s4
4000112c: 000a8593 mv a1,s5
40001130: e2040513 addi a0,s0,-480
40001134: 194100ef jal ra,400112c8 <SHA512_Update>
/* Compute alternate SHA512 sum with input KEY, SALT, and KEY. The
* final result will be added to the first context. */
SHA512_Init(&alt_ctx);
40001138: ef040513 addi a0,s0,-272
4000113c: 0f0100ef jal ra,4001122c <SHA512_Init>
/* Add key. */
SHA512_Update(&alt_ctx, key, key_len);
40001140: 00090613 mv a2,s2
40001144: 00098593 mv a1,s3
40001148: ef040513 addi a0,s0,-272
4000114c: 17c100ef jal ra,400112c8 <SHA512_Update>
/* Add salt. */
SHA512_Update(&alt_ctx, salt, salt_len);
40001150: 000a0613 mv a2,s4
40001154: 000a8593 mv a1,s5
40001158: ef040513 addi a0,s0,-272
4000115c: 16c100ef jal ra,400112c8 <SHA512_Update>
/* Add key again. */
SHA512_Update(&alt_ctx, key, key_len);
40001160: 00090613 mv a2,s2
40001164: 00098593 mv a1,s3
40001168: ef040513 addi a0,s0,-272
4000116c: 15c100ef jal ra,400112c8 <SHA512_Update>
/* Now get result of this (64 bytes) and add it to the other context. */
SHA512_Final(alt_result, &alt_ctx);
40001170: ef040593 addi a1,s0,-272
40001174: da040513 addi a0,s0,-608
40001178: 29c100ef jal ra,40011414 <SHA512_Final>
/* Add for any character in the key one byte of the alternate sum. */
for (cnt = key_len; cnt > 64; cnt -= 64)
4000117c: 04000793 li a5,64
40001180: 6527f463 bgeu a5,s2,400017c8 <crypt_sha512_r+0x76c>
40001184: 00090493 mv s1,s2
SHA512_Update(&ctx, alt_result, 64);
40001188: 04000613 li a2,64
4000118c: da040593 addi a1,s0,-608
40001190: e2040513 addi a0,s0,-480
40001194: 134100ef jal ra,400112c8 <SHA512_Update>
for (cnt = key_len; cnt > 64; cnt -= 64)
40001198: fc048493 addi s1,s1,-64
4000119c: 04000793 li a5,64
400011a0: fe97e4e3 bltu a5,s1,40001188 <crypt_sha512_r+0x12c>
400011a4: fbf90793 addi a5,s2,-65
400011a8: fc07f793 andi a5,a5,-64
400011ac: fc090613 addi a2,s2,-64
SHA512_Update(&ctx, alt_result, cnt);
400011b0: 40f60633 sub a2,a2,a5
400011b4: da040593 addi a1,s0,-608
400011b8: e2040513 addi a0,s0,-480
400011bc: 10c100ef jal ra,400112c8 <SHA512_Update>
key_len = strlen(key);
400011c0: 00090493 mv s1,s2
/* Take the binary representation of the length of the key and for
* every 1 add the alternate sum, for every 0 the key. */
for (cnt = key_len; cnt > 0; cnt >>= 1)
if ((cnt & 1) != 0)
400011c4: 0014f793 andi a5,s1,1
SHA512_Update(&ctx, alt_result, 64);
400011c8: 04000613 li a2,64
400011cc: da040593 addi a1,s0,-608
400011d0: e2040513 addi a0,s0,-480
if ((cnt & 1) != 0)
400011d4: 00079863 bnez a5,400011e4 <crypt_sha512_r+0x188>
else
SHA512_Update(&ctx, key, key_len);
400011d8: 00090613 mv a2,s2
400011dc: 00098593 mv a1,s3
400011e0: e2040513 addi a0,s0,-480
for (cnt = key_len; cnt > 0; cnt >>= 1)
400011e4: 0014d493 srli s1,s1,0x1
SHA512_Update(&ctx, key, key_len);
400011e8: 0e0100ef jal ra,400112c8 <SHA512_Update>
for (cnt = key_len; cnt > 0; cnt >>= 1)
400011ec: fc049ce3 bnez s1,400011c4 <crypt_sha512_r+0x168>
/* Create intermediate result. */
SHA512_Final(alt_result, &ctx);
400011f0: da040513 addi a0,s0,-608
400011f4: e2040593 addi a1,s0,-480
400011f8: 21c100ef jal ra,40011414 <SHA512_Final>
/* Start computation of P byte sequence. */
SHA512_Init(&alt_ctx);
400011fc: ef040513 addi a0,s0,-272
40001200: 02c100ef jal ra,4001122c <SHA512_Init>
/* For every character in the password add the entire password. */
for (cnt = 0; cnt < key_len; ++cnt)
40001204: 00148493 addi s1,s1,1
SHA512_Update(&alt_ctx, key, key_len);
40001208: 00090613 mv a2,s2
4000120c: 00098593 mv a1,s3
40001210: ef040513 addi a0,s0,-272
40001214: 0b4100ef jal ra,400112c8 <SHA512_Update>
for (cnt = 0; cnt < key_len; ++cnt)
40001218: ff24e6e3 bltu s1,s2,40001204 <crypt_sha512_r+0x1a8>
/* Finish the digest. */
SHA512_Final(temp_result, &alt_ctx);
4000121c: de040493 addi s1,s0,-544
40001220: 00048513 mv a0,s1
40001224: ef040593 addi a1,s0,-272
40001228: 1ec100ef jal ra,40011414 <SHA512_Final>
/* Create byte sequence P. */
cp = p_bytes = alloca(key_len);
4000122c: 01790793 addi a5,s2,23
40001230: ff07f793 andi a5,a5,-16
40001234: 40f10133 sub sp,sp,a5
40001238: 00f10b13 addi s6,sp,15
4000123c: ff0b7b13 andi s6,s6,-16
40001240: d9642a23 sw s6,-620(s0)
for (cnt = key_len; cnt >= 64; cnt -= 64) {
40001244: 03f00793 li a5,63
40001248: 000b0513 mv a0,s6
4000124c: 5d27f463 bgeu a5,s2,40001814 <crypt_sha512_r+0x7b8>
40001250: 00090c13 mv s8,s2
40001254: 03f00993 li s3,63
memcpy(cp, temp_result, 64);
40001258: 04000613 li a2,64
4000125c: 00048593 mv a1,s1
40001260: 6c5190ef jal ra,4001b124 <memcpy>
cp += 64;
40001264: d9442503 lw a0,-620(s0)
for (cnt = key_len; cnt >= 64; cnt -= 64) {
40001268: fc0c0c13 addi s8,s8,-64
cp += 64;
4000126c: 04050513 addi a0,a0,64
40001270: d8a42a23 sw a0,-620(s0)
for (cnt = key_len; cnt >= 64; cnt -= 64) {
40001274: ff89e2e3 bltu s3,s8,40001258 <crypt_sha512_r+0x1fc>
40001278: 03f97613 andi a2,s2,63
}
memcpy(cp, temp_result, cnt);
4000127c: 00048593 mv a1,s1
40001280: 6a5190ef jal ra,4001b124 <memcpy>
/* Start computation of S byte sequence. */
SHA512_Init(&alt_ctx);
40001284: ef040513 addi a0,s0,-272
40001288: 7a50f0ef jal ra,4001122c <SHA512_Init>
/* For every character in the password add the entire password. */
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
4000128c: 00000993 li s3,0
SHA512_Update(&alt_ctx, salt, salt_len);
40001290: 000a0613 mv a2,s4
40001294: 000a8593 mv a1,s5
40001298: ef040513 addi a0,s0,-272
4000129c: 02c100ef jal ra,400112c8 <SHA512_Update>
for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
400012a0: da044783 lbu a5,-608(s0)
400012a4: 00198993 addi s3,s3,1
400012a8: 01078793 addi a5,a5,16
400012ac: fef9e2e3 bltu s3,a5,40001290 <crypt_sha512_r+0x234>
/* Finish the digest. */
SHA512_Final(temp_result, &alt_ctx);
400012b0: 00048513 mv a0,s1
400012b4: ef040593 addi a1,s0,-272
400012b8: 15c100ef jal ra,40011414 <SHA512_Final>
/* Create byte sequence S. */
cp = s_bytes = alloca(salt_len);
400012bc: 017a0793 addi a5,s4,23
400012c0: ff07f793 andi a5,a5,-16
400012c4: 40f10133 sub sp,sp,a5
400012c8: 00f10d13 addi s10,sp,15
400012cc: ff0d7d13 andi s10,s10,-16
for (cnt = salt_len; cnt >= 64; cnt -= 64) {
memcpy(cp, temp_result, 64);
cp += 64;
}
memcpy(cp, temp_result, cnt);
400012d0: 00048593 mv a1,s1
400012d4: 000a0613 mv a2,s4
400012d8: 000d0513 mv a0,s10
cp = s_bytes = alloca(salt_len);
400012dc: d9a42a23 sw s10,-620(s0)
/* Repeatedly run the collected hash value through SHA512 to burn CPU
* cycles. */
for (cnt = 0; cnt < rounds; ++cnt) {
400012e0: 00000493 li s1,0
memcpy(cp, temp_result, cnt);
400012e4: 641190ef jal ra,4001b124 <memcpy>
/* Add key or last result. */
if ((cnt & 1) != 0)
SHA512_Update(&ctx, p_bytes, key_len);
else
SHA512_Update(&ctx, alt_result, 64);
400012e8: 00300c93 li s9,3
/* Add salt for numbers not divisible by 3. */
if (cnt % 3 != 0)
SHA512_Update(&ctx, s_bytes, salt_len);
400012ec: 00700c13 li s8,7
if ((cnt & 1) != 0)
400012f0: 0014f993 andi s3,s1,1
SHA512_Init(&ctx);
400012f4: e2040513 addi a0,s0,-480
400012f8: 7350f0ef jal ra,4001122c <SHA512_Init>
if ((cnt & 1) != 0)
400012fc: 3e098063 beqz s3,400016dc <crypt_sha512_r+0x680>
SHA512_Update(&ctx, p_bytes, key_len);
40001300: 00090613 mv a2,s2
40001304: 000b0593 mv a1,s6
40001308: e2040513 addi a0,s0,-480
4000130c: 7bd0f0ef jal ra,400112c8 <SHA512_Update>
SHA512_Update(&ctx, alt_result, 64);
40001310: 0394f7b3 remu a5,s1,s9
if (cnt % 3 != 0)
40001314: 3e079063 bnez a5,400016f4 <crypt_sha512_r+0x698>
SHA512_Update(&ctx, s_bytes, salt_len);
40001318: 0384f7b3 remu a5,s1,s8
/* Add key for numbers not divisible by 7. */
if (cnt % 7 != 0)
4000131c: 38079c63 bnez a5,400016b4 <crypt_sha512_r+0x658>
SHA512_Update(&ctx, p_bytes, key_len);
/* Add key or last result. */
if ((cnt & 1) != 0)
40001320: 3a098463 beqz s3,400016c8 <crypt_sha512_r+0x66c>
SHA512_Update(&ctx, alt_result, 64);
40001324: 04000613 li a2,64
40001328: da040593 addi a1,s0,-608
4000132c: e2040513 addi a0,s0,-480
40001330: 7990f0ef jal ra,400112c8 <SHA512_Update>
for (cnt = 0; cnt < rounds; ++cnt) {
40001334: 00148493 addi s1,s1,1
else
SHA512_Update(&ctx, p_bytes, key_len);
/* Create intermediate result. */
SHA512_Final(alt_result, &ctx);
40001338: e2040593 addi a1,s0,-480
4000133c: da040513 addi a0,s0,-608
40001340: 0d4100ef jal ra,40011414 <SHA512_Final>
for (cnt = 0; cnt < rounds; ++cnt) {
40001344: fa9b96e3 bne s7,s1,400012f0 <crypt_sha512_r+0x294>
}
/* Now we can construct the result string. It consists of three
* parts. */
cp = stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));
40001348: d9c42483 lw s1,-612(s0)
4000134c: b6c18593 addi a1,gp,-1172 # 40024e2c <sha512_salt_prefix>
40001350: fff4c613 not a2,s1
40001354: 41f65613 srai a2,a2,0x1f
40001358: 00c4f633 and a2,s1,a2
4000135c: 000d8513 mv a0,s11
40001360: 25c1a0ef jal ra,4001b5bc <stpncpy>
buflen -= sizeof(sha512_salt_prefix) - 1;
40001364: ffd48493 addi s1,s1,-3
if (rounds_custom) {
40001368: d8c42703 lw a4,-628(s0)
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
4000136c: fff4c593 not a1,s1
40001370: 41f5d593 srai a1,a1,0x1f
cp = stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));
40001374: d8a42a23 sw a0,-620(s0)
buflen -= sizeof(sha512_salt_prefix) - 1;
40001378: d8942e23 sw s1,-612(s0)
cp = stpncpy(buffer, sha512_salt_prefix, MAX(0, buflen));
4000137c: 00050793 mv a5,a0
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
40001380: 00b4f5b3 and a1,s1,a1
if (rounds_custom) {
40001384: 3e071a63 bnez a4,40001778 <crypt_sha512_r+0x71c>
cp += n;
buflen -= n;
}
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40001388: 000a0613 mv a2,s4
4000138c: 0145f463 bgeu a1,s4,40001394 <crypt_sha512_r+0x338>
40001390: 00058613 mv a2,a1 <== NOT EXECUTED
40001394: 00078513 mv a0,a5
40001398: 000a8593 mv a1,s5
4000139c: 2201a0ef jal ra,4001b5bc <stpncpy>
buflen -= MIN((size_t)MAX(0, buflen), salt_len);
400013a0: d9c42783 lw a5,-612(s0)
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
400013a4: d8a42a23 sw a0,-620(s0)
buflen -= MIN((size_t)MAX(0, buflen), salt_len);
400013a8: 00000713 li a4,0
400013ac: 0007c863 bltz a5,400013bc <crypt_sha512_r+0x360> <== NEVER TAKEN
400013b0: 00078713 mv a4,a5
400013b4: 00fa7463 bgeu s4,a5,400013bc <crypt_sha512_r+0x360>
400013b8: 000a0713 mv a4,s4
400013bc: 40e787b3 sub a5,a5,a4
400013c0: d8f42e23 sw a5,-612(s0)
if (buflen > 0) {
400013c4: 02f05063 blez a5,400013e4 <crypt_sha512_r+0x388> <== NEVER TAKEN
*cp++ = '$';
400013c8: 00150793 addi a5,a0,1
400013cc: d8f42a23 sw a5,-620(s0)
400013d0: 02400793 li a5,36
400013d4: 00f50023 sb a5,0(a0)
--buflen;
400013d8: d9c42783 lw a5,-612(s0)
400013dc: fff78793 addi a5,a5,-1
400013e0: d8f42e23 sw a5,-612(s0)
}
b64_from_24bit(alt_result[0], alt_result[21], alt_result[42], 4, &buflen, &cp);
400013e4: dca44603 lbu a2,-566(s0)
400013e8: db544583 lbu a1,-587(s0)
400013ec: da044503 lbu a0,-608(s0)
400013f0: 00400693 li a3,4
400013f4: d9440793 addi a5,s0,-620
400013f8: d9c40713 addi a4,s0,-612
400013fc: 450000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[22], alt_result[43], alt_result[1], 4, &buflen, &cp);
40001400: da144603 lbu a2,-607(s0)
40001404: dcb44583 lbu a1,-565(s0)
40001408: db644503 lbu a0,-586(s0)
4000140c: d9440793 addi a5,s0,-620
40001410: d9c40713 addi a4,s0,-612
40001414: 00400693 li a3,4
40001418: 434000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[44], alt_result[2], alt_result[23], 4, &buflen, &cp);
4000141c: db744603 lbu a2,-585(s0)
40001420: da244583 lbu a1,-606(s0)
40001424: dcc44503 lbu a0,-564(s0)
40001428: d9440793 addi a5,s0,-620
4000142c: d9c40713 addi a4,s0,-612
40001430: 00400693 li a3,4
40001434: 418000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[3], alt_result[24], alt_result[45], 4, &buflen, &cp);
40001438: dcd44603 lbu a2,-563(s0)
4000143c: db844583 lbu a1,-584(s0)
40001440: da344503 lbu a0,-605(s0)
40001444: d9440793 addi a5,s0,-620
40001448: d9c40713 addi a4,s0,-612
4000144c: 00400693 li a3,4
40001450: 3fc000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[25], alt_result[46], alt_result[4], 4, &buflen, &cp);
40001454: da444603 lbu a2,-604(s0)
40001458: dce44583 lbu a1,-562(s0)
4000145c: db944503 lbu a0,-583(s0)
40001460: d9440793 addi a5,s0,-620
40001464: d9c40713 addi a4,s0,-612
40001468: 00400693 li a3,4
4000146c: 3e0000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[47], alt_result[5], alt_result[26], 4, &buflen, &cp);
40001470: dba44603 lbu a2,-582(s0)
40001474: da544583 lbu a1,-603(s0)
40001478: dcf44503 lbu a0,-561(s0)
4000147c: d9440793 addi a5,s0,-620
40001480: d9c40713 addi a4,s0,-612
40001484: 00400693 li a3,4
40001488: 3c4000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[6], alt_result[27], alt_result[48], 4, &buflen, &cp);
4000148c: dd044603 lbu a2,-560(s0)
40001490: dbb44583 lbu a1,-581(s0)
40001494: da644503 lbu a0,-602(s0)
40001498: d9440793 addi a5,s0,-620
4000149c: d9c40713 addi a4,s0,-612
400014a0: 00400693 li a3,4
400014a4: 3a8000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[28], alt_result[49], alt_result[7], 4, &buflen, &cp);
400014a8: da744603 lbu a2,-601(s0)
400014ac: dd144583 lbu a1,-559(s0)
400014b0: dbc44503 lbu a0,-580(s0)
400014b4: d9440793 addi a5,s0,-620
400014b8: d9c40713 addi a4,s0,-612
400014bc: 00400693 li a3,4
400014c0: 38c000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[50], alt_result[8], alt_result[29], 4, &buflen, &cp);
400014c4: dbd44603 lbu a2,-579(s0)
400014c8: da844583 lbu a1,-600(s0)
400014cc: dd244503 lbu a0,-558(s0)
400014d0: d9440793 addi a5,s0,-620
400014d4: d9c40713 addi a4,s0,-612
400014d8: 00400693 li a3,4
400014dc: 370000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[9], alt_result[30], alt_result[51], 4, &buflen, &cp);
400014e0: dd344603 lbu a2,-557(s0)
400014e4: dbe44583 lbu a1,-578(s0)
400014e8: da944503 lbu a0,-599(s0)
400014ec: d9440793 addi a5,s0,-620
400014f0: d9c40713 addi a4,s0,-612
400014f4: 00400693 li a3,4
400014f8: 354000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[31], alt_result[52], alt_result[10], 4, &buflen, &cp);
400014fc: daa44603 lbu a2,-598(s0)
40001500: dd444583 lbu a1,-556(s0)
40001504: dbf44503 lbu a0,-577(s0)
40001508: d9440793 addi a5,s0,-620
4000150c: d9c40713 addi a4,s0,-612
40001510: 00400693 li a3,4
40001514: 338000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[53], alt_result[11], alt_result[32], 4, &buflen, &cp);
40001518: dc044603 lbu a2,-576(s0)
4000151c: dab44583 lbu a1,-597(s0)
40001520: dd544503 lbu a0,-555(s0)
40001524: d9440793 addi a5,s0,-620
40001528: d9c40713 addi a4,s0,-612
4000152c: 00400693 li a3,4
40001530: 31c000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[12], alt_result[33], alt_result[54], 4, &buflen, &cp);
40001534: dd644603 lbu a2,-554(s0)
40001538: dc144583 lbu a1,-575(s0)
4000153c: dac44503 lbu a0,-596(s0)
40001540: d9440793 addi a5,s0,-620
40001544: d9c40713 addi a4,s0,-612
40001548: 00400693 li a3,4
4000154c: 300000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[34], alt_result[55], alt_result[13], 4, &buflen, &cp);
40001550: dad44603 lbu a2,-595(s0)
40001554: dd744583 lbu a1,-553(s0)
40001558: dc244503 lbu a0,-574(s0)
4000155c: d9440793 addi a5,s0,-620
40001560: d9c40713 addi a4,s0,-612
40001564: 00400693 li a3,4
40001568: 2e4000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[56], alt_result[14], alt_result[35], 4, &buflen, &cp);
4000156c: dc344603 lbu a2,-573(s0)
40001570: dae44583 lbu a1,-594(s0)
40001574: dd844503 lbu a0,-552(s0)
40001578: d9440793 addi a5,s0,-620
4000157c: d9c40713 addi a4,s0,-612
40001580: 00400693 li a3,4
40001584: 2c8000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[15], alt_result[36], alt_result[57], 4, &buflen, &cp);
40001588: dd944603 lbu a2,-551(s0)
4000158c: dc444583 lbu a1,-572(s0)
40001590: daf44503 lbu a0,-593(s0)
40001594: d9440793 addi a5,s0,-620
40001598: d9c40713 addi a4,s0,-612
4000159c: 00400693 li a3,4
400015a0: 2ac000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[37], alt_result[58], alt_result[16], 4, &buflen, &cp);
400015a4: db044603 lbu a2,-592(s0)
400015a8: dda44583 lbu a1,-550(s0)
400015ac: dc544503 lbu a0,-571(s0)
400015b0: d9440793 addi a5,s0,-620
400015b4: d9c40713 addi a4,s0,-612
400015b8: 00400693 li a3,4
400015bc: 290000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[59], alt_result[17], alt_result[38], 4, &buflen, &cp);
400015c0: dc644603 lbu a2,-570(s0)
400015c4: db144583 lbu a1,-591(s0)
400015c8: ddb44503 lbu a0,-549(s0)
400015cc: d9440793 addi a5,s0,-620
400015d0: d9c40713 addi a4,s0,-612
400015d4: 00400693 li a3,4
400015d8: 274000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[18], alt_result[39], alt_result[60], 4, &buflen, &cp);
400015dc: ddc44603 lbu a2,-548(s0)
400015e0: dc744583 lbu a1,-569(s0)
400015e4: db244503 lbu a0,-590(s0)
400015e8: d9440793 addi a5,s0,-620
400015ec: d9c40713 addi a4,s0,-612
400015f0: 00400693 li a3,4
400015f4: 258000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[40], alt_result[61], alt_result[19], 4, &buflen, &cp);
400015f8: db344603 lbu a2,-589(s0)
400015fc: ddd44583 lbu a1,-547(s0)
40001600: dc844503 lbu a0,-568(s0)
40001604: d9440793 addi a5,s0,-620
40001608: d9c40713 addi a4,s0,-612
4000160c: 00400693 li a3,4
40001610: 23c000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(alt_result[62], alt_result[20], alt_result[41], 4, &buflen, &cp);
40001614: dc944603 lbu a2,-567(s0)
40001618: db444583 lbu a1,-588(s0)
4000161c: dde44503 lbu a0,-546(s0)
40001620: d9440793 addi a5,s0,-620
40001624: d9c40713 addi a4,s0,-612
40001628: 00400693 li a3,4
4000162c: 220000ef jal ra,4000184c <_crypt_b64_from_24bit>
b64_from_24bit(0, 0, alt_result[63], 2, &buflen, &cp);
40001630: ddf44603 lbu a2,-545(s0)
40001634: d9440793 addi a5,s0,-620
40001638: d9c40713 addi a4,s0,-612
4000163c: 00200693 li a3,2
40001640: 00000593 li a1,0
40001644: 00000513 li a0,0
40001648: 204000ef jal ra,4000184c <_crypt_b64_from_24bit>
if (buflen <= 0) {
4000164c: d9c42783 lw a5,-612(s0)
40001650: 16f05263 blez a5,400017b4 <crypt_sha512_r+0x758> <== NEVER TAKEN
errno = ERANGE;
buffer = NULL;
}
else
*cp = '\0'; /* Terminate the string. */
40001654: d9442783 lw a5,-620(s0)
40001658: 00078023 sb zero,0(a5)
/* Clear the buffer for the intermediate result so that people
* attaching to processes or reading core dumps cannot get any
* information. We do it in this way to clear correct_words[] inside
* the SHA512 implementation as well. */
SHA512_Init(&ctx);
4000165c: e2040513 addi a0,s0,-480
40001660: 3cd0f0ef jal ra,4001122c <SHA512_Init>
SHA512_Final(alt_result, &ctx);
40001664: da040513 addi a0,s0,-608
40001668: e2040593 addi a1,s0,-480
4000166c: 5a90f0ef jal ra,40011414 <SHA512_Final>
memset(copied_key, '\0', key_len);
if (copied_salt != NULL)
memset(copied_salt, '\0', salt_len);
return buffer;
}
40001670: d8040113 addi sp,s0,-640
40001674: 27c12083 lw ra,636(sp)
40001678: 000d8513 mv a0,s11
4000167c: 27812403 lw s0,632(sp)
40001680: 27412483 lw s1,628(sp)
40001684: 27012903 lw s2,624(sp)
40001688: 26c12983 lw s3,620(sp)
4000168c: 26812a03 lw s4,616(sp)
40001690: 26412a83 lw s5,612(sp)
40001694: 26012b03 lw s6,608(sp)
40001698: 25c12b83 lw s7,604(sp)
4000169c: 25812c03 lw s8,600(sp)
400016a0: 25412c83 lw s9,596(sp)
400016a4: 25012d03 lw s10,592(sp)
400016a8: 24c12d83 lw s11,588(sp)
400016ac: 28010113 addi sp,sp,640
400016b0: 00008067 ret
SHA512_Update(&ctx, p_bytes, key_len);
400016b4: 00090613 mv a2,s2
400016b8: 000b0593 mv a1,s6
400016bc: e2040513 addi a0,s0,-480
400016c0: 4090f0ef jal ra,400112c8 <SHA512_Update>
if ((cnt & 1) != 0)
400016c4: c60990e3 bnez s3,40001324 <crypt_sha512_r+0x2c8>
SHA512_Update(&ctx, p_bytes, key_len);
400016c8: 00090613 mv a2,s2
400016cc: 000b0593 mv a1,s6
400016d0: e2040513 addi a0,s0,-480
400016d4: 3f50f0ef jal ra,400112c8 <SHA512_Update>
400016d8: c5dff06f j 40001334 <crypt_sha512_r+0x2d8>
SHA512_Update(&ctx, alt_result, 64);
400016dc: 04000613 li a2,64
400016e0: da040593 addi a1,s0,-608
400016e4: e2040513 addi a0,s0,-480
400016e8: 3e10f0ef jal ra,400112c8 <SHA512_Update>
400016ec: 0394f7b3 remu a5,s1,s9
if (cnt % 3 != 0)
400016f0: c20784e3 beqz a5,40001318 <crypt_sha512_r+0x2bc>
SHA512_Update(&ctx, s_bytes, salt_len);
400016f4: 000a0613 mv a2,s4
400016f8: 000d0593 mv a1,s10
400016fc: e2040513 addi a0,s0,-480
40001700: 3c90f0ef jal ra,400112c8 <SHA512_Update>
40001704: c15ff06f j 40001318 <crypt_sha512_r+0x2bc>
if (strncmp(sha512_salt_prefix, salt, sizeof(sha512_salt_prefix) - 1) == 0)
40001708: 0025c703 lbu a4,2(a1)
4000170c: 9ae79ce3 bne a5,a4,400010c4 <crypt_sha512_r+0x68>
salt += sizeof(sha512_salt_prefix) - 1;
40001710: 00358a93 addi s5,a1,3
if (strncmp(salt, sha512_rounds_prefix, sizeof(sha512_rounds_prefix) - 1)
40001714: 00700613 li a2,7
40001718: b6418593 addi a1,gp,-1180 # 40024e24 <sha512_rounds_prefix>
4000171c: 000a8513 mv a0,s5
40001720: 35c1a0ef jal ra,4001ba7c <strncmp>
40001724: 9a051ae3 bnez a0,400010d8 <crypt_sha512_r+0x7c>
srounds = strtoul(num, &endp, 10);
40001728: 00a00613 li a2,10
4000172c: d9840593 addi a1,s0,-616
40001730: 007a8513 addi a0,s5,7
40001734: 5451a0ef jal ra,4001c478 <strtoul>
if (*endp == '$') {
40001738: d9842783 lw a5,-616(s0)
4000173c: 02400713 li a4,36
40001740: 0007c683 lbu a3,0(a5)
40001744: 98e69ae3 bne a3,a4,400010d8 <crypt_sha512_r+0x7c>
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
40001748: 3b9ad737 lui a4,0x3b9ad
4000174c: 9ff70713 addi a4,a4,-1537 # 3b9ac9ff <RamSize+0x3a9ac9ff>
40001750: 00050b93 mv s7,a0
salt = endp + 1;
40001754: 00178a93 addi s5,a5,1
rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
40001758: 00a77463 bgeu a4,a0,40001760 <crypt_sha512_r+0x704>
4000175c: 00070b93 mv s7,a4 <== NOT EXECUTED
40001760: 3e800793 li a5,1000
40001764: 00fbf463 bgeu s7,a5,4000176c <crypt_sha512_r+0x710>
40001768: 3e800b93 li s7,1000
rounds_custom = true;
4000176c: 00100793 li a5,1
40001770: d8f42623 sw a5,-628(s0)
40001774: 971ff06f j 400010e4 <crypt_sha512_r+0x88>
n = snprintf(cp, MAX(0, buflen), "%s%zu$",
40001778: 40023637 lui a2,0x40023
4000177c: b6418693 addi a3,gp,-1180 # 40024e24 <sha512_rounds_prefix>
40001780: 000b8713 mv a4,s7
40001784: 8a860613 addi a2,a2,-1880 # 400228a8 <test_cases_sha512+0x5c>
40001788: 52d190ef jal ra,4001b4b4 <snprintf>
buflen -= n;
4000178c: d9c42583 lw a1,-612(s0)
cp += n;
40001790: d9442783 lw a5,-620(s0)
buflen -= n;
40001794: 40a584b3 sub s1,a1,a0
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
40001798: fff4c593 not a1,s1
cp += n;
4000179c: 00a787b3 add a5,a5,a0
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
400017a0: 41f5d593 srai a1,a1,0x1f
cp += n;
400017a4: d8f42a23 sw a5,-620(s0)
buflen -= n;
400017a8: d8942e23 sw s1,-612(s0)
cp = stpncpy(cp, salt, MIN((size_t)MAX(0, buflen), salt_len));
400017ac: 00b4f5b3 and a1,s1,a1
400017b0: bd9ff06f j 40001388 <crypt_sha512_r+0x32c>
errno = ERANGE;
400017b4: 045190ef jal ra,4001aff8 <__errno> <== NOT EXECUTED
400017b8: 02200793 li a5,34 <== NOT EXECUTED
400017bc: 00f52023 sw a5,0(a0) <== NOT EXECUTED
buffer = NULL;
400017c0: 00000d93 li s11,0 <== NOT EXECUTED
400017c4: e99ff06f j 4000165c <crypt_sha512_r+0x600> <== NOT EXECUTED
SHA512_Update(&ctx, alt_result, cnt);
400017c8: 00090613 mv a2,s2
400017cc: da040593 addi a1,s0,-608
400017d0: e2040513 addi a0,s0,-480
400017d4: 2f50f0ef jal ra,400112c8 <SHA512_Update>
for (cnt = key_len; cnt > 0; cnt >>= 1)
400017d8: 9e0914e3 bnez s2,400011c0 <crypt_sha512_r+0x164> <== ALWAYS TAKEN
SHA512_Final(alt_result, &ctx);
400017dc: e2040593 addi a1,s0,-480 <== NOT EXECUTED
400017e0: da040513 addi a0,s0,-608 <== NOT EXECUTED
400017e4: 4310f0ef jal ra,40011414 <SHA512_Final> <== NOT EXECUTED
SHA512_Init(&alt_ctx);
400017e8: ef040513 addi a0,s0,-272 <== NOT EXECUTED
400017ec: 2410f0ef jal ra,4001122c <SHA512_Init> <== NOT EXECUTED
SHA512_Final(temp_result, &alt_ctx);
400017f0: de040493 addi s1,s0,-544 <== NOT EXECUTED
400017f4: 00048513 mv a0,s1 <== NOT EXECUTED
400017f8: ef040593 addi a1,s0,-272 <== NOT EXECUTED
400017fc: 4190f0ef jal ra,40011414 <SHA512_Final> <== NOT EXECUTED
cp = p_bytes = alloca(key_len);
40001800: 00010b13 mv s6,sp <== NOT EXECUTED
40001804: d8242a23 sw sp,-620(s0) <== NOT EXECUTED
40001808: 00010513 mv a0,sp <== NOT EXECUTED
4000180c: 00000613 li a2,0 <== NOT EXECUTED
40001810: a6dff06f j 4000127c <crypt_sha512_r+0x220> <== NOT EXECUTED
for (cnt = key_len; cnt >= 64; cnt -= 64) {
40001814: 00090613 mv a2,s2
40001818: a65ff06f j 4000127c <crypt_sha512_r+0x220>