⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dx86unix.cpp

📁 提供了很多种加密算法和CA认证及相关服务如CMP、OCSP等的开发
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	xorl	%ebx,		%ebx
	movl	20(%ebp),	%edx
	xorl	%edi,		%eax
	xorl	%edi,		%edx
	andl	$0xfcfcfcfc,	%eax
	andl	$0xcfcfcfcf,	%edx
	movb	%al,		%bl
	movb	%ah,		%cl
	rorl	$4,		%edx
	movl	      des_SPtrans(%ebx),%ebp
	movb	%dl,		%bl
	xorl	%ebp,		%esi
	movl	0x200+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%esi
	movb	%dh,		%cl
	shrl	$16,		%eax
	movl	0x100+des_SPtrans(%ebx),%ebp
	xorl	%ebp,		%esi
	movb	%ah,		%bl
	shrl	$16,		%edx
	movl	0x300+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%esi
	movl	24(%esp),	%ebp
	movb	%dh,		%cl
	andl	$0xff,		%eax
	andl	$0xff,		%edx
	movl	0x600+des_SPtrans(%ebx),%ebx
	xorl	%ebx,		%esi
	movl	0x700+des_SPtrans(%ecx),%ebx
	xorl	%ebx,		%esi
	movl	0x400+des_SPtrans(%eax),%ebx
	xorl	%ebx,		%esi
	movl	0x500+des_SPtrans(%edx),%ebx
	xorl	%ebx,		%esi

	/* Round 1 */
	movl	8(%ebp),	%eax
	xorl	%ebx,		%ebx
	movl	12(%ebp),	%edx
	xorl	%esi,		%eax
	xorl	%esi,		%edx
	andl	$0xfcfcfcfc,	%eax
	andl	$0xcfcfcfcf,	%edx
	movb	%al,		%bl
	movb	%ah,		%cl
	rorl	$4,		%edx
	movl	      des_SPtrans(%ebx),%ebp
	movb	%dl,		%bl
	xorl	%ebp,		%edi
	movl	0x200+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%edi
	movb	%dh,		%cl
	shrl	$16,		%eax
	movl	0x100+des_SPtrans(%ebx),%ebp
	xorl	%ebp,		%edi
	movb	%ah,		%bl
	shrl	$16,		%edx
	movl	0x300+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%edi
	movl	24(%esp),	%ebp
	movb	%dh,		%cl
	andl	$0xff,		%eax
	andl	$0xff,		%edx
	movl	0x600+des_SPtrans(%ebx),%ebx
	xorl	%ebx,		%edi
	movl	0x700+des_SPtrans(%ecx),%ebx
	xorl	%ebx,		%edi
	movl	0x400+des_SPtrans(%eax),%ebx
	xorl	%ebx,		%edi
	movl	0x500+des_SPtrans(%edx),%ebx
	xorl	%ebx,		%edi

	/* Round 0 */
	movl	(%ebp),		%eax
	xorl	%ebx,		%ebx
	movl	4(%ebp),	%edx
	xorl	%edi,		%eax
	xorl	%edi,		%edx
	andl	$0xfcfcfcfc,	%eax
	andl	$0xcfcfcfcf,	%edx
	movb	%al,		%bl
	movb	%ah,		%cl
	rorl	$4,		%edx
	movl	      des_SPtrans(%ebx),%ebp
	movb	%dl,		%bl
	xorl	%ebp,		%esi
	movl	0x200+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%esi
	movb	%dh,		%cl
	shrl	$16,		%eax
	movl	0x100+des_SPtrans(%ebx),%ebp
	xorl	%ebp,		%esi
	movb	%ah,		%bl
	shrl	$16,		%edx
	movl	0x300+des_SPtrans(%ecx),%ebp
	xorl	%ebp,		%esi
	movl	24(%esp),	%ebp
	movb	%dh,		%cl
	andl	$0xff,		%eax
	andl	$0xff,		%edx
	movl	0x600+des_SPtrans(%ebx),%ebx
	xorl	%ebx,		%esi
	movl	0x700+des_SPtrans(%ecx),%ebx
	xorl	%ebx,		%esi
	movl	0x400+des_SPtrans(%eax),%ebx
	xorl	%ebx,		%esi
	movl	0x500+des_SPtrans(%edx),%ebx
	xorl	%ebx,		%esi
.L003end:

	/* Fixup */
	rorl	$3,		%edi
	movl	20(%esp),	%eax
	rorl	$3,		%esi
	movl	%edi,		(%eax)
	movl	%esi,		4(%eax)
	popl	%ebp
	popl	%ebx
	popl	%edi
	popl	%esi
	ret
.des_encrypt2_end:
	SIZE(des_encrypt2,.des_encrypt2_end-des_encrypt2)
.ident	"desasm.pl"
.text
	.align ALIGN
.globl des_encrypt3
	TYPE(des_encrypt3,@function)
des_encrypt3:
	pushl	%ebx
	movl	8(%esp),	%ebx
	pushl	%ebp
	pushl	%esi
	pushl	%edi

	/* Load the data words */
	movl	(%ebx),		%edi
	movl	4(%ebx),	%esi

	/* IP */
	roll	$4,		%edi
	movl	%edi,		%edx
	xorl	%esi,		%edi
	andl	$0xf0f0f0f0,	%edi
	xorl	%edi,		%edx
	xorl	%edi,		%esi

	roll	$20,		%esi
	movl	%esi,		%edi
	xorl	%edx,		%esi
	andl	$0xfff0000f,	%esi
	xorl	%esi,		%edi
	xorl	%esi,		%edx

	roll	$14,		%edi
	movl	%edi,		%esi
	xorl	%edx,		%edi
	andl	$0x33333333,	%edi
	xorl	%edi,		%esi
	xorl	%edi,		%edx

	roll	$22,		%edx
	movl	%edx,		%edi
	xorl	%esi,		%edx
	andl	$0x03fc03fc,	%edx
	xorl	%edx,		%edi
	xorl	%edx,		%esi

	roll	$9,		%edi
	movl	%edi,		%edx
	xorl	%esi,		%edi
	andl	$0xaaaaaaaa,	%edi
	xorl	%edi,		%edx
	xorl	%edi,		%esi

	rorl	$3,		%edx
	rorl	$2,		%esi
	movl	%esi,		4(%ebx)
	movl	24(%esp),	%eax
	movl	%edx,		(%ebx)
	movl	28(%esp),	%edi
	movl	32(%esp),	%esi
	pushl	$1
	pushl	%eax
	pushl	%ebx
	call	des_encrypt2
	pushl	$0
	pushl	%edi
	pushl	%ebx
	call	des_encrypt2
	pushl	$1
	pushl	%esi
	pushl	%ebx
	call	des_encrypt2
	movl	(%ebx),		%edi
	addl	$36,		%esp
	movl	4(%ebx),	%esi

	/* FP */
	roll	$2,		%esi
	roll	$3,		%edi
	movl	%edi,		%eax
	xorl	%esi,		%edi
	andl	$0xaaaaaaaa,	%edi
	xorl	%edi,		%eax
	xorl	%edi,		%esi

	roll	$23,		%eax
	movl	%eax,		%edi
	xorl	%esi,		%eax
	andl	$0x03fc03fc,	%eax
	xorl	%eax,		%edi
	xorl	%eax,		%esi

	roll	$10,		%edi
	movl	%edi,		%eax
	xorl	%esi,		%edi
	andl	$0x33333333,	%edi
	xorl	%edi,		%eax
	xorl	%edi,		%esi

	roll	$18,		%esi
	movl	%esi,		%edi
	xorl	%eax,		%esi
	andl	$0xfff0000f,	%esi
	xorl	%esi,		%edi
	xorl	%esi,		%eax

	roll	$12,		%edi
	movl	%edi,		%esi
	xorl	%eax,		%edi
	andl	$0xf0f0f0f0,	%edi
	xorl	%edi,		%esi
	xorl	%edi,		%eax

	rorl	$4,		%eax
	movl	%eax,		(%ebx)
	movl	%esi,		4(%ebx)
	popl	%edi
	popl	%esi
	popl	%ebp
	popl	%ebx
	ret
.des_encrypt3_end:
	SIZE(des_encrypt3,.des_encrypt3_end-des_encrypt3)
.ident	"desasm.pl"
.text
	.align ALIGN
.globl des_decrypt3
	TYPE(des_decrypt3,@function)
des_decrypt3:
	pushl	%ebx
	movl	8(%esp),	%ebx
	pushl	%ebp
	pushl	%esi
	pushl	%edi

	/* Load the data words */
	movl	(%ebx),		%edi
	movl	4(%ebx),	%esi

	/* IP */
	roll	$4,		%edi
	movl	%edi,		%edx
	xorl	%esi,		%edi
	andl	$0xf0f0f0f0,	%edi
	xorl	%edi,		%edx
	xorl	%edi,		%esi

	roll	$20,		%esi
	movl	%esi,		%edi
	xorl	%edx,		%esi
	andl	$0xfff0000f,	%esi
	xorl	%esi,		%edi
	xorl	%esi,		%edx

	roll	$14,		%edi
	movl	%edi,		%esi
	xorl	%edx,		%edi
	andl	$0x33333333,	%edi
	xorl	%edi,		%esi
	xorl	%edi,		%edx

	roll	$22,		%edx
	movl	%edx,		%edi
	xorl	%esi,		%edx
	andl	$0x03fc03fc,	%edx
	xorl	%edx,		%edi
	xorl	%edx,		%esi

	roll	$9,		%edi
	movl	%edi,		%edx
	xorl	%esi,		%edi
	andl	$0xaaaaaaaa,	%edi
	xorl	%edi,		%edx
	xorl	%edi,		%esi

	rorl	$3,		%edx
	rorl	$2,		%esi
	movl	%esi,		4(%ebx)
	movl	24(%esp),	%esi
	movl	%edx,		(%ebx)
	movl	28(%esp),	%edi
	movl	32(%esp),	%eax
	pushl	$0
	pushl	%eax
	pushl	%ebx
	call	des_encrypt2
	pushl	$1
	pushl	%edi
	pushl	%ebx
	call	des_encrypt2
	pushl	$0
	pushl	%esi
	pushl	%ebx
	call	des_encrypt2
	movl	(%ebx),		%edi
	addl	$36,		%esp
	movl	4(%ebx),	%esi

	/* FP */
	roll	$2,		%esi
	roll	$3,		%edi
	movl	%edi,		%eax
	xorl	%esi,		%edi
	andl	$0xaaaaaaaa,	%edi
	xorl	%edi,		%eax
	xorl	%edi,		%esi

	roll	$23,		%eax
	movl	%eax,		%edi
	xorl	%esi,		%eax
	andl	$0x03fc03fc,	%eax
	xorl	%eax,		%edi
	xorl	%eax,		%esi

	roll	$10,		%edi
	movl	%edi,		%eax
	xorl	%esi,		%edi
	andl	$0x33333333,	%edi
	xorl	%edi,		%eax
	xorl	%edi,		%esi

	roll	$18,		%esi
	movl	%esi,		%edi
	xorl	%eax,		%esi
	andl	$0xfff0000f,	%esi
	xorl	%esi,		%edi
	xorl	%esi,		%eax

	roll	$12,		%edi
	movl	%edi,		%esi
	xorl	%eax,		%edi
	andl	$0xf0f0f0f0,	%edi
	xorl	%edi,		%esi
	xorl	%edi,		%eax

	rorl	$4,		%eax
	movl	%eax,		(%ebx)
	movl	%esi,		4(%ebx)
	popl	%edi
	popl	%esi
	popl	%ebp
	popl	%ebx
	ret
.des_decrypt3_end:
	SIZE(des_decrypt3,.des_decrypt3_end-des_decrypt3)
.ident	"desasm.pl"
.text
	.align ALIGN
.globl des_ncbc_encrypt
	TYPE(des_ncbc_encrypt,@function)
des_ncbc_encrypt:

	pushl	%ebp
	pushl	%ebx
	pushl	%esi
	pushl	%edi
	movl	28(%esp),	%ebp
	/* getting iv ptr from parameter 4 */
	movl	36(%esp),	%ebx
	movl	(%ebx),		%esi
	movl	4(%ebx),	%edi
	pushl	%edi
	pushl	%esi
	pushl	%edi
	pushl	%esi
	movl	%esp,		%ebx
	movl	36(%esp),	%esi
	movl	40(%esp),	%edi
	/* getting encrypt flag from parameter 5 */
	movl	56(%esp),	%ecx
	/* get and push parameter 5 */
	pushl	%ecx
	/* get and push parameter 3 */
	movl	52(%esp),	%eax
	pushl	%eax
	pushl	%ebx
	cmpl	$0,		%ecx
	jz	.L004decrypt
	andl	$4294967288,	%ebp
	movl	12(%esp),	%eax
	movl	16(%esp),	%ebx
	jz	.L005encrypt_finish
.L006encrypt_loop:
	movl	(%esi),		%ecx
	movl	4(%esi),	%edx
	xorl	%ecx,		%eax
	xorl	%edx,		%ebx
	movl	%eax,		12(%esp)
	movl	%ebx,		16(%esp)
	call	des_encrypt
	movl	12(%esp),	%eax
	movl	16(%esp),	%ebx
	movl	%eax,		(%edi)
	movl	%ebx,		4(%edi)
	addl	$8,		%esi
	addl	$8,		%edi
	subl	$8,		%ebp
	jnz	.L006encrypt_loop
.L005encrypt_finish:
	movl	56(%esp),	%ebp
	andl	$7,		%ebp
	jz	.L007finish
	xorl	%ecx,		%ecx
	xorl	%edx,		%edx
	movl	.L008cbc_enc_jmp_table(,%ebp,4),%ebp
	jmp	*%ebp
.L009ej7:
	movb	6(%esi),	%dh
	sall	$8,		%edx
.L010ej6:
	movb	5(%esi),	%dh
.L011ej5:
	movb	4(%esi),	%dl
.L012ej4:
	movl	(%esi),		%ecx
	jmp	.L013ejend
.L014ej3:
	movb	2(%esi),	%ch
	sall	$8,		%ecx
.L015ej2:
	movb	1(%esi),	%ch
.L016ej1:
	movb	(%esi),		%cl
.L013ejend:
	xorl	%ecx,		%eax
	xorl	%edx,		%ebx
	movl	%eax,		12(%esp)
	movl	%ebx,		16(%esp)
	call	des_encrypt
	movl	12(%esp),	%eax
	movl	16(%esp),	%ebx
	movl	%eax,		(%edi)
	movl	%ebx,		4(%edi)
	jmp	.L007finish
.align ALIGN
.L004decrypt:
	andl	$4294967288,	%ebp
	movl	20(%esp),	%eax
	movl	24(%esp),	%ebx
	jz	.L017decrypt_finish
.L018decrypt_loop:
	movl	(%esi),		%eax
	movl	4(%esi),	%ebx
	movl	%eax,		12(%esp)
	movl	%ebx,		16(%esp)
	call	des_encrypt
	movl	12(%esp),	%eax
	movl	16(%esp),	%ebx
	movl	20(%esp),	%ecx
	movl	24(%esp),	%edx
	xorl	%eax,		%ecx
	xorl	%ebx,		%edx
	movl	(%esi),		%eax
	movl	4(%esi),	%ebx
	movl	%ecx,		(%edi)
	movl	%edx,		4(%edi)
	movl	%eax,		20(%esp)
	movl	%ebx,		24(%esp)
	addl	$8,		%esi
	addl	$8,		%edi
	subl	$8,		%ebp
	jnz	.L018decrypt_loop
.L017decrypt_finish:
	movl	56(%esp),	%ebp
	andl	$7,		%ebp
	jz	.L007finish
	movl	(%esi),		%eax
	movl	4(%esi),	%ebx
	movl	%eax,		12(%esp)
	movl	%ebx,		16(%esp)
	call	des_encrypt
	movl	12(%esp),	%eax
	movl	16(%esp),	%ebx
	movl	20(%esp),	%ecx
	movl	24(%esp),	%edx
	xorl	%eax,		%ecx
	xorl	%ebx,		%edx
	movl	(%esi),		%eax
	movl	4(%esi),	%ebx
.L019dj7:
	rorl	$16,		%edx
	movb	%dl,		6(%edi)
	shrl	$16,		%edx
.L020dj6:
	movb	%dh,		5(%edi)
.L021dj5:
	movb	%dl,		4(%edi)
.L022dj4:
	movl	%ecx,		(%edi)
	jmp	.L023djend
.L024dj3:
	rorl	$16,		%ecx
	movb	%cl,		2(%edi)
	sall	$16,		%ecx
.L025dj2:
	movb	%ch,		1(%esi)
.L026dj1:
	movb	%cl,		(%esi)
.L023djend:
	jmp	.L007finish
.align ALIGN
.L007finish:
	movl	64(%esp),	%ecx
	addl	$28,		%esp
	movl	%eax,		(%ecx)
	movl	%ebx,		4(%ecx)
	popl	%edi
	popl	%esi
	popl	%ebx
	popl	%ebp
	ret
.align ALIGN
.L008cbc_enc_jmp_table:
	.long 0
	.long .L016ej1
	.long .L015ej2
	.long .L014ej3
	.long .L012ej4
	.long .L011ej5
	.long .L010ej6
	.long .L009ej7
.align ALIGN
.L027cbc_dec_jmp_table:
	.long 0
	.long .L026dj1
	.long .L025dj2
	.long .L024dj3
	.long .L022dj4
	.long .L021dj5
	.long .L020dj6
	.long .L019dj7
.des_ncbc_encrypt_end:
	SIZE(des_ncbc_encrypt,.des_ncbc_encrypt_end-des_ncbc_encrypt)
.ident	"desasm.pl"
.text
	.align ALIGN
.globl des_ede3_cbc_encrypt
	TYPE(des_ede3_cbc_encrypt,@function)
des_ede3_cbc_encrypt:

	pushl	%ebp
	pushl	%ebx
	pushl	%esi
	pushl	%edi
	movl	28(%esp),	%ebp
	/* getting iv ptr from parameter 6 */
	movl	44(%esp),	%ebx
	movl	(%ebx),		%esi
	movl	4(%ebx),	%edi
	pushl	%edi
	pushl	%esi
	pushl	%edi
	pushl	%esi
	movl	%esp,		%ebx
	movl	36(%esp),	%esi
	movl	40(%esp),	%edi
	/* getting encrypt flag from parameter 7 */
	movl	64(%esp),	%ecx
	/* get and push parameter 5 */
	movl	56(%esp),	%eax
	pushl	%eax
	/* get and push parameter 4 */
	movl	56(%esp),	%eax
	pushl	%eax
	/* get and push parameter 3 */
	movl	56(%esp),	%eax
	pushl	%eax
	pushl	%ebx
	cmpl	$0,		%ecx
	jz	.L028decrypt
	andl	$4294967288,	%ebp
	movl	16(%esp),	%eax
	movl	20(%esp),	%ebx
	jz	.L029encrypt_finish
.L030encrypt_loop:
	movl	(%esi),		%ecx
	movl	4(%esi),	%edx
	xorl	%ecx,		%eax
	xorl	%edx,		%ebx
	movl	%eax,		16(%esp)
	movl	%ebx,		20(%esp)
	call	des_encrypt3
	movl	16(%esp),	%eax
	movl	20(%esp),	%ebx
	movl	%eax,		(%edi)
	movl	%ebx,		4(%edi)
	addl	$8,		%esi
	add

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -