	.file	"extr_ecdsa_ossl.c_ossl_ecdsa_sign_sig.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	ossl_ecdsa_sign_sig
	.type	ossl_ecdsa_sign_sig, @function
ossl_ecdsa_sign_sig:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, r8
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 88
	.cfi_def_cfa_offset 144
	mov	QWORD PTR 24[rsp], rdi
	mov	rdi, r8
	mov	DWORD PTR 32[rsp], esi
	mov	QWORD PTR 8[rsp], rdx
	mov	QWORD PTR 16[rsp], rcx
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	mov	QWORD PTR 64[rsp], 0
	call	EC_KEY_get0_group@PLT
	mov	rdi, r14
	mov	rbx, rax
	call	EC_KEY_get0_private_key@PLT
	test	rbx, rbx
	je	.L49
	mov	r13, rax
	test	rax, rax
	je	.L50
	mov	rdi, r14
	call	EC_KEY_can_sign@PLT
	test	eax, eax
	je	.L51
	xor	eax, eax
	call	ECDSA_SIG_new@PLT
	mov	r12, rax
	test	rax, rax
	je	.L52
	xor	eax, eax
	call	BN_new@PLT
	mov	QWORD PTR [r12], rax
	xor	eax, eax
	call	BN_new@PLT
	cmp	QWORD PTR [r12], 0
	mov	QWORD PTR 8[r12], rax
	mov	r15, rax
	je	.L29
	test	rax, rax
	je	.L29
	xor	eax, eax
	call	BN_CTX_new@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L11
	xor	eax, eax
	call	BN_new@PLT
	mov	QWORD PTR [rsp], rax
	test	rax, rax
	je	.L11
	mov	rdi, rbx
	call	EC_GROUP_get0_order@PLT
	mov	rdi, rax
	mov	QWORD PTR 40[rsp], rax
	call	BN_num_bits@PLT
	mov	ecx, DWORD PTR 32[rsp]
	mov	r8d, eax
	lea	eax, 0[0+rcx*8]
	cmp	eax, r8d
	jg	.L53
	mov	rdx, QWORD PTR [rsp]
	mov	esi, DWORD PTR 32[rsp]
	mov	rdi, QWORD PTR 24[rsp]
	call	BN_bin2bn@PLT
	test	eax, eax
	je	.L22
.L14:
	cmp	QWORD PTR 8[rsp], 0
	mov	QWORD PTR 56[rsp], r14
	mov	r14, r13
	sete	dl
	cmp	QWORD PTR 16[rsp], 0
	sete	al
	or	edx, eax
	lea	rax, 64[rsp]
	mov	BYTE PTR 36[rsp], dl
	mov	QWORD PTR 48[rsp], rax
	.p2align 4,,10
	.p2align 3
.L40:
	cmp	BYTE PTR 36[rsp], 0
	je	.L15
	mov	r9d, DWORD PTR 32[rsp]
	mov	r8, QWORD PTR 24[rsp]
	mov	rcx, r12
	mov	rsi, rbp
	mov	rdx, QWORD PTR 48[rsp]
	mov	rdi, QWORD PTR 56[rsp]
	call	ecdsa_sign_setup@PLT
	test	eax, eax
	je	.L54
	mov	r13, QWORD PTR 64[rsp]
.L17:
	mov	edx, DWORD PTR [rbx]
	mov	rsi, QWORD PTR [r12]
	mov	rcx, rbp
	mov	rdi, r15
	call	bn_to_mont_fixed_top@PLT
	test	eax, eax
	je	.L22
	mov	ecx, DWORD PTR [rbx]
	mov	r8, rbp
	mov	rdx, r14
	mov	rsi, r15
	mov	rdi, r15
	call	bn_mul_mont_fixed_top@PLT
	test	eax, eax
	je	.L22
	mov	rcx, QWORD PTR 40[rsp]
	mov	rdx, QWORD PTR [rsp]
	mov	rsi, r15
	mov	rdi, r15
	call	bn_mod_add_fixed_top@PLT
	test	eax, eax
	je	.L22
	mov	edx, DWORD PTR [rbx]
	mov	rcx, rbp
	mov	rsi, r15
	mov	rdi, r15
	call	bn_to_mont_fixed_top@PLT
	test	eax, eax
	je	.L22
	mov	ecx, DWORD PTR [rbx]
	mov	r8, rbp
	mov	rdx, r13
	mov	rsi, r15
	mov	rdi, r15
	call	BN_mod_mul_montgomery@PLT
	test	eax, eax
	je	.L22
	mov	rdi, r15
	call	BN_is_zero@PLT
	test	rax, rax
	je	.L28
	cmp	QWORD PTR 8[rsp], 0
	je	.L40
	cmp	QWORD PTR 16[rsp], 0
	je	.L40
	mov	esi, DWORD PTR EC_R_NEED_NEW_SETUP_VALUES[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L29:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	xor	ebp, ebp
	call	ECerr@PLT
	mov	QWORD PTR [rsp], 0
.L9:
	mov	rdi, r12
	xor	r13d, r13d
	call	ECDSA_SIG_free@PLT
.L23:
	mov	rdi, rbp
	call	BN_CTX_free@PLT
	mov	rdi, QWORD PTR [rsp]
	call	BN_clear_free@PLT
	mov	rdi, QWORD PTR 64[rsp]
	call	BN_clear_free@PLT
.L1:
	mov	rax, QWORD PTR 72[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L55
	add	rsp, 88
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rax, r13
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L53:
	.cfi_restore_state
	mov	esi, r8d
	lea	ecx, 14[r8]
	mov	rdx, QWORD PTR [rsp]
	mov	rdi, QWORD PTR 24[rsp]
	add	esi, 7
	mov	DWORD PTR 48[rsp], r8d
	cmovns	ecx, esi
	sar	ecx, 3
	mov	esi, ecx
	mov	DWORD PTR 32[rsp], ecx
	mov	DWORD PTR 36[rsp], ecx
	call	BN_bin2bn@PLT
	mov	ecx, DWORD PTR 36[rsp]
	mov	r8d, DWORD PTR 48[rsp]
	test	eax, eax
	je	.L22
	sal	ecx, 3
	cmp	ecx, r8d
	jle	.L14
	mov	rsi, QWORD PTR [rsp]
	mov	eax, r8d
	mov	edx, 8
	and	eax, 7
	sub	edx, eax
	mov	rdi, rsi
	call	BN_rshift@PLT
	test	eax, eax
	jne	.L14
	.p2align 4,,10
	.p2align 3
.L22:
	mov	esi, DWORD PTR ERR_R_BN_LIB[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L15:
	mov	rsi, QWORD PTR 16[rsp]
	mov	rdi, QWORD PTR [r12]
	call	BN_copy@PLT
	test	rax, rax
	je	.L56
	mov	r13, QWORD PTR 8[rsp]
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L11:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	mov	QWORD PTR [rsp], 0
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L51:
	mov	esi, DWORD PTR EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L50:
	mov	esi, DWORD PTR EC_R_MISSING_PRIVATE_KEY[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L52:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L49:
	mov	esi, DWORD PTR ERR_R_PASSED_NULL_PARAMETER[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L28:
	mov	r13, r12
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L56:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L54:
	mov	esi, DWORD PTR ERR_R_ECDSA_LIB[rip]
	mov	edi, DWORD PTR EC_F_OSSL_ECDSA_SIGN_SIG[rip]
	call	ECerr@PLT
	jmp	.L9
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ossl_ecdsa_sign_sig, .-ossl_ecdsa_sign_sig
	.comm	ERR_R_PASSED_NULL_PARAMETER,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_ECDSA_LIB,4,4
	.comm	ERR_R_BN_LIB,4,4
	.comm	EC_R_NEED_NEW_SETUP_VALUES,4,4
	.comm	EC_R_MISSING_PRIVATE_KEY,4,4
	.comm	EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING,4,4
	.comm	EC_F_OSSL_ECDSA_SIGN_SIG,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_ecdsa_ossl.c_ossl_ecdsa_sign_sig.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	ossl_ecdsa_sign_sig
	.syntax unified
	.arm
	.fpu softvfp
	.type	ossl_ecdsa_sign_sig, %function
ossl_ecdsa_sign_sig:
	@ args = 4, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r5, #0
	sub	sp, sp, #44
	ldr	r9, [sp, #80]
	str	r3, [sp, #20]
	ldr	r3, .L54
	str	r0, [sp, #16]
	str	r1, [sp, #12]
	str	r2, [sp, #8]
	mov	r0, r9
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	str	r5, [sp, #32]
	bl	EC_KEY_get0_group
	mov	r6, r0
	mov	r0, r9
	bl	EC_KEY_get0_private_key
	cmp	r6, r5
	beq	.L44
	cmp	r0, #0
	mov	r8, r0
	beq	.L45
	mov	r0, r9
	bl	EC_KEY_can_sign
	subs	r3, r0, #0
	beq	.L46
	bl	ECDSA_SIG_new
	subs	r7, r0, #0
	beq	.L47
	bl	BN_new
	str	r0, [r7]
	bl	BN_new
	ldr	r3, [r7]
	mov	r4, r0
	cmp	r0, #0
	cmpne	r3, #0
	str	r0, [r7, #4]
	beq	.L10
	bl	BN_CTX_new
	subs	r5, r0, #0
	beq	.L10
	bl	BN_new
	subs	r10, r0, #0
	beq	.L10
	mov	r0, r6
	bl	EC_GROUP_get0_order
	str	r0, [sp, #24]
	bl	BN_num_bits
	ldr	r3, [sp, #12]
	mov	fp, r0
	cmp	r0, r3, lsl #3
	blt	.L48
	mov	r2, r10
	ldr	r1, [sp, #12]
	ldr	r0, [sp, #16]
	bl	BN_bin2bn
	cmp	r0, #0
	beq	.L21
.L13:
	ldr	fp, [sp, #20]
	ldr	r2, [sp, #8]
	clz	r3, fp
	cmp	r2, #0
	lsr	r3, r3, #5
	moveq	r3, #1
	str	r9, [sp, #28]
	str	r3, [sp, #20]
	b	.L23
.L51:
	ldr	r3, [sp, #12]
	mov	r1, r5
	str	r3, [sp, #4]
	ldr	r3, [sp, #16]
	ldr	r0, [sp, #28]
	str	r3, [sp]
	add	r2, sp, #32
	mov	r3, r7
	bl	ecdsa_sign_setup
	cmp	r0, #0
	beq	.L49
	ldr	r9, [sp, #32]
.L16:
	mov	r3, r5
	mov	r0, r4
	ldr	r2, [r6]
	ldr	r1, [r7]
	bl	bn_to_mont_fixed_top
	cmp	r0, #0
	beq	.L21
	ldr	r3, [r6]
	mov	r2, r8
	mov	r1, r4
	mov	r0, r4
	str	r5, [sp]
	bl	bn_mul_mont_fixed_top
	cmp	r0, #0
	beq	.L21
	mov	r2, r10
	mov	r1, r4
	mov	r0, r4
	ldr	r3, [sp, #24]
	bl	bn_mod_add_fixed_top
	cmp	r0, #0
	beq	.L21
	mov	r3, r5
	mov	r1, r4
	mov	r0, r4
	ldr	r2, [r6]
	bl	bn_to_mont_fixed_top
	cmp	r0, #0
	beq	.L21
	ldr	r3, [r6]
	mov	r2, r9
	mov	r1, r4
	mov	r0, r4
	str	r5, [sp]
	bl	BN_mod_mul_montgomery
	cmp	r0, #0
	beq	.L21
	mov	r0, r4
	bl	BN_is_zero
	cmp	r0, #0
	beq	.L27
	ldr	r3, [sp, #8]
	cmp	r3, #0
	cmpne	fp, #0
	bne	.L50
.L23:
	ldr	r3, [sp, #20]
	cmp	r3, #0
	bne	.L51
	mov	r1, fp
	ldr	r0, [r7]
	bl	BN_copy
	cmp	r0, #0
	beq	.L52
	ldr	r9, [sp, #8]
	b	.L16
.L10:
	ldr	r2, .L54+4
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	mov	r10, #0
.L8:
	mov	r0, r7
	bl	ECDSA_SIG_free
	mov	r8, #0
.L22:
	mov	r0, r5
	bl	BN_CTX_free
	mov	r0, r10
	bl	BN_clear_free
	ldr	r0, [sp, #32]
	bl	BN_clear_free
.L1:
	ldr	r3, .L54
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L53
	mov	r0, r8
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L48:
	adds	r1, r0, #7
	addmi	r1, r0, #14
	asr	r3, r1, #3
	mov	r1, r3
	mov	r2, r10
	ldr	r0, [sp, #16]
	str	r3, [sp, #12]
	bl	BN_bin2bn
	cmp	r0, #0
	beq	.L21
	ldr	r3, [sp, #12]
	cmp	fp, r3, lsl #3
	bge	.L13
	and	r2, fp, #7
	mov	r1, r10
	mov	r0, r10
	rsb	r2, r2, #8
	bl	BN_rshift
	cmp	r0, #0
	bne	.L13
.L21:
	ldr	r2, .L54+12
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	b	.L8
.L46:
	ldr	r2, .L54+8
	ldr	r1, .L54+16
	ldr	r0, [r2]
	ldr	r1, [r1]
	mov	r8, r3
	bl	ECerr
	b	.L1
.L45:
	ldr	r2, .L54+20
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	b	.L1
.L47:
	ldr	r2, .L54+4
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	mov	r8, r7
	bl	ECerr
	b	.L1
.L44:
	ldr	r2, .L54+24
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	mov	r8, r6
	bl	ECerr
	b	.L1
.L27:
	mov	r8, r7
	b	.L22
.L50:
	ldr	r2, .L54+28
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	b	.L8
.L52:
	ldr	r2, .L54+4
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	b	.L8
.L49:
	ldr	r2, .L54+32
	ldr	r3, .L54+8
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	b	.L8
.L53:
	bl	__stack_chk_fail
.L55:
	.align	2
.L54:
	.word	.LC0
	.word	ERR_R_MALLOC_FAILURE
	.word	EC_F_OSSL_ECDSA_SIGN_SIG
	.word	ERR_R_BN_LIB
	.word	EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING
	.word	EC_R_MISSING_PRIVATE_KEY
	.word	ERR_R_PASSED_NULL_PARAMETER
	.word	EC_R_NEED_NEW_SETUP_VALUES
	.word	ERR_R_ECDSA_LIB
	.size	ossl_ecdsa_sign_sig, .-ossl_ecdsa_sign_sig
	.comm	ERR_R_PASSED_NULL_PARAMETER,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_ECDSA_LIB,4,4
	.comm	ERR_R_BN_LIB,4,4
	.comm	EC_R_NEED_NEW_SETUP_VALUES,4,4
	.comm	EC_R_MISSING_PRIVATE_KEY,4,4
	.comm	EC_R_CURVE_DOES_NOT_SUPPORT_SIGNING,4,4
	.comm	EC_F_OSSL_ECDSA_SIGN_SIG,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
