	.file	"extr_cms_sd.c_cms_SignerInfo_content_sign.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	cms_SignerInfo_content_sign, @function
cms_SignerInfo_content_sign:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	.cfi_offset 15, -24
	mov	r15, rdi
	push	r14
	push	r13
	push	r12
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12, rsi
	push	rbx
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 40
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	call	EVP_MD_CTX_new@PLT
	test	rax, rax
	je	.L55
	mov	r14d, DWORD PTR 4[r12]
	mov	r13, rax
	test	r14d, r14d
	je	.L56
	mov	edx, DWORD PTR 16[r12]
	mov	rsi, rbx
	mov	rdi, rax
	call	cms_DigestAlgorithm_find_ctx@PLT
	test	eax, eax
	je	.L53
	cmp	QWORD PTR 8[r12], 0
	je	.L11
	xor	esi, esi
	mov	rdi, r12
	call	cms_sd_asn1_ctrl@PLT
	test	eax, eax
	je	.L53
.L11:
	mov	rdi, r12
	call	CMS_signed_get_attr_count@PLT
	test	rax, rax
	jns	.L57
	mov	r15, QWORD PTR 8[r12]
	test	r15, r15
	je	.L16
	movsx	rax, DWORD PTR EVP_MAX_MD_SIZE[rip]
	mov	rcx, rsp
	mov	rbx, rsp
	add	rax, 15
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L18
.L58:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L58
.L18:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	je	.L19
	or	QWORD PTR -8[rsp+rdx], 0
.L19:
	lea	rdx, -68[rbp]
	mov	rsi, rsp
	mov	rdi, r13
	call	EVP_DigestFinal_ex@PLT
	test	eax, eax
	je	.L20
	mov	edi, DWORD PTR 4[r12]
	call	EVP_PKEY_size@PLT
	mov	rdi, rax
	mov	QWORD PTR -64[rbp], rax
	call	OPENSSL_malloc@PLT
	mov	r14, rax
	test	rax, rax
	je	.L59
	mov	r8d, DWORD PTR -68[rbp]
	lea	rdx, -64[rbp]
	mov	rcx, rsp
	mov	rsi, rax
	mov	rdi, r15
	call	EVP_PKEY_sign@PLT
	test	rax, rax
	jle	.L60
	mov	edx, DWORD PTR -64[rbp]
	mov	edi, DWORD PTR [r12]
	mov	rsi, r14
	mov	r14d, 1
	call	ASN1_STRING_set0@PLT
	mov	rsp, rbx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	mov	rsp, rbx
.L53:
	xor	r15d, r15d
	xor	r14d, r14d
.L5:
	mov	rdi, r13
	call	EVP_MD_CTX_free@PLT
	mov	rdi, r15
	call	EVP_PKEY_CTX_free@PLT
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L61
	lea	rsp, -40[rbp]
	mov	eax, r14d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L56:
	.cfi_restore_state
	mov	esi, DWORD PTR CMS_R_NO_PRIVATE_KEY[rip]
	mov	edi, DWORD PTR CMS_F_CMS_SIGNERINFO_CONTENT_SIGN[rip]
	xor	r15d, r15d
	call	CMSerr@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L57:
	movsx	rax, DWORD PTR EVP_MAX_MD_SIZE[rip]
	mov	rcx, rsp
	mov	rbx, rsp
	add	rax, 15
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L13
.L62:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L62
.L13:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	je	.L14
	or	QWORD PTR -8[rsp+rdx], 0
.L14:
	lea	rdx, -64[rbp]
	mov	rsi, rsp
	mov	rdi, r13
	call	EVP_DigestFinal_ex@PLT
	test	eax, eax
	je	.L15
	mov	r8d, DWORD PTR -64[rbp]
	mov	edx, DWORD PTR V_ASN1_OCTET_STRING[rip]
	mov	rcx, rsp
	mov	rdi, r12
	mov	esi, DWORD PTR NID_pkcs9_messageDigest[rip]
	call	CMS_signed_add1_attr_by_NID@PLT
	test	eax, eax
	je	.L15
	mov	rsi, r12
	mov	rdi, r15
	call	cms_set_si_contentType_attr@PLT
	test	eax, eax
	je	.L15
	mov	rdi, r12
	call	CMS_SignerInfo_sign@PLT
	test	eax, eax
	je	.L15
	xor	r15d, r15d
	mov	r14d, 1
	mov	rsp, rbx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L55:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR CMS_F_CMS_SIGNERINFO_CONTENT_SIGN[rip]
	xor	r14d, r14d
	call	CMSerr@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	mov	edi, DWORD PTR 4[r12]
	call	EVP_PKEY_size@PLT
	mov	rdi, rax
	call	OPENSSL_malloc@PLT
	mov	r14, rax
	test	rax, rax
	je	.L63
	mov	ecx, DWORD PTR 4[r12]
	lea	rdx, -64[rbp]
	mov	rsi, rax
	mov	rdi, r13
	call	EVP_SignFinal@PLT
	test	eax, eax
	je	.L64
	mov	edx, DWORD PTR -64[rbp]
	mov	edi, DWORD PTR [r12]
	mov	rsi, r14
	mov	r14d, 1
	call	ASN1_STRING_set0@PLT
	jmp	.L5
.L63:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR CMS_F_CMS_SIGNERINFO_CONTENT_SIGN[rip]
	call	CMSerr@PLT
.L24:
	xor	r14d, r14d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L59:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR CMS_F_CMS_SIGNERINFO_CONTENT_SIGN[rip]
	call	CMSerr@PLT
.L20:
	xor	r14d, r14d
	mov	rsp, rbx
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L64:
	mov	esi, DWORD PTR CMS_R_SIGNFINAL_ERROR[rip]
	mov	edi, DWORD PTR CMS_F_CMS_SIGNERINFO_CONTENT_SIGN[rip]
	call	CMSerr@PLT
	mov	rdi, r14
	call	OPENSSL_free@PLT
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L60:
	mov	rdi, r14
	call	OPENSSL_free@PLT
	jmp	.L20
.L61:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	cms_SignerInfo_content_sign, .-cms_SignerInfo_content_sign
	.comm	V_ASN1_OCTET_STRING,4,4
	.comm	NID_pkcs9_messageDigest,4,4
	.comm	EVP_MAX_MD_SIZE,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	CMS_R_SIGNFINAL_ERROR,4,4
	.comm	CMS_R_NO_PRIVATE_KEY,4,4
	.comm	CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cms_sd.c_cms_SignerInfo_content_sign.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cms_SignerInfo_content_sign, %function
cms_SignerInfo_content_sign:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, fp, lr}
	add	fp, sp, #28
	sub	sp, sp, #24
	ldr	r3, .L51
	mov	r8, r0
	mov	r4, r1
	mov	r6, r2
	ldr	r3, [r3]
	str	r3, [fp, #-32]
	mov	r3,#0
	bl	EVP_MD_CTX_new
	subs	r7, r0, #0
	beq	.L42
	ldr	r5, [r4, #4]
	cmp	r5, #0
	beq	.L43
	mov	r1, r6
	ldr	r2, [r4, #12]
	bl	cms_DigestAlgorithm_find_ctx
	cmp	r0, #0
	beq	.L10
	ldr	r3, [r4, #8]
	cmp	r3, #0
	beq	.L11
	mov	r1, #0
	mov	r0, r4
	bl	cms_sd_asn1_ctrl
	cmp	r0, #0
	beq	.L10
.L11:
	mov	r0, r4
	bl	CMS_signed_get_attr_count
	cmp	r0, #0
	bge	.L44
	ldr	r6, [r4, #8]
	cmp	r6, #0
	beq	.L13
	ldr	r3, .L51+4
	mov	r8, sp
	ldr	r3, [r3]
	mov	r0, r7
	add	r3, r3, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	add	r9, sp, #8
	mov	r1, r9
	sub	r2, fp, #36
	bl	EVP_DigestFinal_ex
	cmp	r0, #0
	beq	.L14
	ldr	r0, [r4, #4]
	bl	EVP_PKEY_size
	str	r0, [fp, #-40]
	bl	OPENSSL_malloc
	subs	r5, r0, #0
	beq	.L45
	ldr	r2, [fp, #-36]
	mov	r3, r9
	str	r2, [sp]
	mov	r1, r5
	mov	r0, r6
	sub	r2, fp, #40
	bl	EVP_PKEY_sign
	cmp	r0, #0
	ble	.L46
	mov	r1, r5
	ldr	r0, [r4]
	ldr	r2, [fp, #-40]
	bl	ASN1_STRING_set0
	mov	r5, #1
	mov	sp, r8
	b	.L5
.L10:
	mov	r6, #0
	mov	r5, r6
.L5:
	mov	r0, r7
	bl	EVP_MD_CTX_free
	mov	r0, r6
	bl	EVP_PKEY_CTX_free
.L1:
	ldr	r3, .L51
	ldr	r2, [r3]
	ldr	r3, [fp, #-32]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L47
	mov	r0, r5
	sub	sp, fp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, fp, pc}
.L43:
	ldr	r2, .L51+8
	ldr	r3, .L51+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	CMSerr
	mov	r6, r5
	b	.L5
.L44:
	ldr	r3, .L51+4
	mov	r9, sp
	ldr	r3, [r3]
	mov	r0, r7
	add	r3, r3, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	add	r5, sp, #8
	mov	r1, r5
	sub	r2, fp, #36
	bl	EVP_DigestFinal_ex
	cmp	r0, #0
	beq	.L12
	ldr	r0, [fp, #-36]
	ldr	r3, .L51+16
	ldr	r2, .L51+20
	ldr	r1, [r3]
	ldr	r2, [r2]
	mov	r3, r5
	str	r0, [sp]
	mov	r0, r4
	bl	CMS_signed_add1_attr_by_NID
	cmp	r0, #0
	bne	.L48
.L12:
	mov	r6, #0
	mov	sp, r9
	mov	r5, r6
	b	.L5
.L42:
	ldr	r2, .L51+24
	ldr	r3, .L51+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	mov	r5, r7
	bl	CMSerr
	b	.L1
.L45:
	ldr	r2, .L51+24
	ldr	r3, .L51+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	CMSerr
.L14:
	mov	r5, #0
	mov	sp, r8
	b	.L5
.L13:
	ldr	r0, [r4, #4]
	bl	EVP_PKEY_size
	bl	OPENSSL_malloc
	subs	r5, r0, #0
	beq	.L49
	mov	r1, r5
	mov	r0, r7
	ldr	r3, [r4, #4]
	sub	r2, fp, #36
	bl	EVP_SignFinal
	cmp	r0, #0
	beq	.L50
	mov	r1, r5
	ldr	r0, [r4]
	ldr	r2, [fp, #-36]
	bl	ASN1_STRING_set0
	mov	r5, #1
	b	.L5
.L48:
	mov	r0, r8
	mov	r1, r4
	bl	cms_set_si_contentType_attr
	cmp	r0, #0
	beq	.L12
	mov	r0, r4
	bl	CMS_SignerInfo_sign
	cmp	r0, #0
	beq	.L12
	mov	r6, #0
	mov	sp, r9
	mov	r5, #1
	b	.L5
.L49:
	ldr	r2, .L51+24
	ldr	r3, .L51+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	CMSerr
.L18:
	mov	r5, #0
	b	.L5
.L50:
	ldr	r2, .L51+28
	ldr	r3, .L51+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	CMSerr
	mov	r0, r5
	bl	OPENSSL_free
	b	.L18
.L46:
	mov	r0, r5
	bl	OPENSSL_free
	b	.L14
.L47:
	bl	__stack_chk_fail
.L52:
	.align	2
.L51:
	.word	.LC0
	.word	EVP_MAX_MD_SIZE
	.word	CMS_R_NO_PRIVATE_KEY
	.word	CMS_F_CMS_SIGNERINFO_CONTENT_SIGN
	.word	NID_pkcs9_messageDigest
	.word	V_ASN1_OCTET_STRING
	.word	ERR_R_MALLOC_FAILURE
	.word	CMS_R_SIGNFINAL_ERROR
	.size	cms_SignerInfo_content_sign, .-cms_SignerInfo_content_sign
	.comm	V_ASN1_OCTET_STRING,4,4
	.comm	NID_pkcs9_messageDigest,4,4
	.comm	EVP_MAX_MD_SIZE,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	CMS_R_SIGNFINAL_ERROR,4,4
	.comm	CMS_R_NO_PRIVATE_KEY,4,4
	.comm	CMS_F_CMS_SIGNERINFO_CONTENT_SIGN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
