	.file	"extr_ecdh_ossl.c_ecdh_simple_compute_key.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	ecdh_simple_compute_key
	.type	ecdh_simple_compute_key, @function
ecdh_simple_compute_key:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xor	eax, eax
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rcx
	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, 40
	.cfi_def_cfa_offset 96
	mov	QWORD PTR 16[rsp], rdi
	mov	QWORD PTR 24[rsp], rsi
	mov	QWORD PTR 8[rsp], rdx
	call	BN_CTX_new@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L14
	mov	rdi, rax
	call	BN_CTX_start@PLT
	mov	rdi, rbp
	call	BN_CTX_get@PLT
	mov	r12, rax
	test	rax, rax
	je	.L25
	mov	rdi, r13
	call	EC_KEY_get0_private_key@PLT
	mov	r14, rax
	test	rax, rax
	je	.L26
	mov	rdi, r13
	call	EC_KEY_get0_group@PLT
	mov	rdi, r13
	mov	r15, rax
	call	EC_KEY_get_flags@PLT
	test	DWORD PTR EC_FLAG_COFACTOR_ECDH[rip], eax
	je	.L5
	xor	edx, edx
	mov	rsi, r12
	mov	rdi, r15
	call	EC_GROUP_get_cofactor@PLT
	test	eax, eax
	je	.L7
	mov	rcx, rbp
	mov	rdx, r14
	mov	rsi, r12
	mov	rdi, r12
	call	BN_mul@PLT
	test	eax, eax
	je	.L7
	mov	r14, r12
.L5:
	mov	rdi, r15
	call	EC_POINT_new@PLT
	mov	rbx, rax
	test	rax, rax
	je	.L22
	mov	rcx, QWORD PTR 8[rsp]
	mov	r9, rbp
	mov	r8, r14
	xor	edx, edx
	mov	rsi, rax
	mov	rdi, r15
	call	EC_POINT_mul@PLT
	mov	r13d, eax
	test	eax, eax
	je	.L23
	mov	r8, rbp
	xor	ecx, ecx
	mov	rdx, r12
	mov	rsi, rbx
	mov	rdi, r15
	call	EC_POINT_get_affine_coordinates@PLT
	mov	r13d, eax
	test	eax, eax
	je	.L23
	mov	rdi, r15
	call	EC_GROUP_get_degree@PLT
	mov	rdi, r12
	lea	r13d, 14[rax]
	add	eax, 7
	cmovs	eax, r13d
	sar	eax, 3
	movsx	r13, eax
	call	BN_num_bytes@PLT
	mov	r14, rax
	cmp	r13, rax
	jb	.L27
	mov	rdi, r13
	call	OPENSSL_malloc@PLT
	mov	r15, rax
	test	rax, rax
	je	.L22
	mov	rdx, r13
	xor	esi, esi
	mov	rdi, rax
	sub	rdx, r14
	mov	QWORD PTR 8[rsp], rdx
	call	memset@PLT
	mov	rdx, QWORD PTR 8[rsp]
	mov	rdi, r12
	lea	rsi, [r15+rdx]
	call	BN_bn2bin@PLT
	cmp	rax, r14
	jne	.L28
	mov	rax, QWORD PTR 16[rsp]
	xor	r12d, r12d
	mov	QWORD PTR [rax], r15
	mov	rax, QWORD PTR 24[rsp]
	mov	QWORD PTR [rax], r13
	mov	r13d, 1
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L14:
	xor	r12d, r12d
	xor	ebx, ebx
	xor	r13d, r13d
.L2:
	mov	rdi, rbx
	call	EC_POINT_clear_free@PLT
	mov	rdi, rbp
	call	BN_CTX_end@PLT
	mov	rdi, rbp
	call	BN_CTX_free@PLT
	mov	rdi, r12
	call	OPENSSL_free@PLT
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	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
.L26:
	.cfi_restore_state
	mov	esi, DWORD PTR EC_R_MISSING_PRIVATE_KEY[rip]
	xor	r12d, r12d
	xor	ebx, ebx
	xor	r13d, r13d
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L23:
	mov	esi, DWORD PTR EC_R_POINT_ARITHMETIC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	xor	r12d, r12d
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L7:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	xor	r12d, r12d
	xor	r13d, r13d
	xor	ebx, ebx
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L25:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	xor	ebx, ebx
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L22:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	xor	r12d, r12d
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L28:
	mov	esi, DWORD PTR ERR_R_BN_LIB[rip]
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	mov	r12, r15
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L27:
	mov	esi, DWORD PTR ERR_R_INTERNAL_ERROR[rip]
	mov	edi, DWORD PTR EC_F_ECDH_SIMPLE_COMPUTE_KEY[rip]
	xor	r12d, r12d
	xor	r13d, r13d
	call	ECerr@PLT
	jmp	.L2
	.cfi_endproc
.LFE0:
	.size	ecdh_simple_compute_key, .-ecdh_simple_compute_key
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_INTERNAL_ERROR,4,4
	.comm	ERR_R_BN_LIB,4,4
	.comm	EC_R_POINT_ARITHMETIC_FAILURE,4,4
	.comm	EC_R_MISSING_PRIVATE_KEY,4,4
	.comm	EC_F_ECDH_SIMPLE_COMPUTE_KEY,4,4
	.comm	EC_FLAG_COFACTOR_ECDH,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_ecdh_ossl.c_ecdh_simple_compute_key.c"
	.text
	.align	2
	.global	ecdh_simple_compute_key
	.syntax unified
	.arm
	.fpu softvfp
	.type	ecdh_simple_compute_key, %function
ecdh_simple_compute_key:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #20
	mov	r9, r0
	mov	r8, r1
	mov	r7, r2
	mov	r6, r3
	bl	BN_CTX_new
	subs	r4, r0, #0
	beq	.L14
	bl	BN_CTX_start
	mov	r0, r4
	bl	BN_CTX_get
	subs	r5, r0, #0
	ldreq	r2, .L31
	beq	.L22
	mov	r0, r6
	bl	EC_KEY_get0_private_key
	subs	r10, r0, #0
	beq	.L26
	mov	r0, r6
	bl	EC_KEY_get0_group
	mov	fp, r0
	mov	r0, r6
	bl	EC_KEY_get_flags
	ldr	r3, .L31+4
	ldr	r3, [r3]
	tst	r0, r3
	beq	.L5
	mov	r2, #0
	mov	r1, r5
	mov	r0, fp
	bl	EC_GROUP_get_cofactor
	cmp	r0, #0
	beq	.L7
	mov	r2, r10
	mov	r3, r4
	mov	r1, r5
	mov	r0, r5
	bl	BN_mul
	cmp	r0, #0
	beq	.L7
	mov	r10, r5
.L5:
	mov	r0, fp
	bl	EC_POINT_new
	subs	r6, r0, #0
	beq	.L27
	mov	r3, r7
	mov	r2, #0
	mov	r1, r6
	mov	r0, fp
	str	r4, [sp, #4]
	str	r10, [sp]
	bl	EC_POINT_mul
	subs	r7, r0, #0
	beq	.L24
	mov	r3, #0
	mov	r2, r5
	mov	r1, r6
	mov	r0, fp
	str	r4, [sp]
	bl	EC_POINT_get_affine_coordinates
	subs	r7, r0, #0
	beq	.L24
	mov	r0, fp
	bl	EC_GROUP_get_degree
	adds	r7, r0, #7
	addmi	r7, r0, #14
	mov	r0, r5
	bl	BN_num_bytes
	asr	r7, r7, #3
	cmp	r7, r0
	mov	r10, r0
	bcc	.L28
	mov	r0, r7
	bl	OPENSSL_malloc
	subs	fp, r0, #0
	beq	.L29
	sub	r2, r7, r10
	mov	r1, #0
	str	r2, [sp, #12]
	bl	memset
	ldr	r2, [sp, #12]
	mov	r0, r5
	add	r1, fp, r2
	bl	BN_bn2bin
	cmp	r0, r10
	bne	.L30
	str	fp, [r9]
	mov	r5, #0
	str	r7, [r8]
	mov	r7, #1
	b	.L2
.L14:
	mov	r5, r4
	mov	r6, r4
	mov	r7, r4
.L2:
	mov	r0, r6
	bl	EC_POINT_clear_free
	mov	r0, r4
	bl	BN_CTX_end
	mov	r0, r4
	bl	BN_CTX_free
	mov	r0, r5
	bl	OPENSSL_free
	mov	r0, r7
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L26:
	mov	r5, r10
	ldr	r2, .L31+8
.L22:
	ldr	r3, .L31+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	mov	r6, r5
	mov	r7, r5
	b	.L2
.L24:
	ldr	r2, .L31+16
	ldr	r3, .L31+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	mov	r5, r7
	b	.L2
.L7:
	mov	r5, #0
	ldr	r2, .L31
	ldr	r3, .L31+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	mov	r7, r5
	mov	r6, r5
	b	.L2
.L27:
	mov	r5, r6
	ldr	r2, .L31
.L23:
	ldr	r3, .L31+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	ECerr
	mov	r7, r5
	b	.L2
.L30:
	ldr	r2, .L31+20
	ldr	r3, .L31+12
	ldr	r1, [r2]
	ldr	r0, [r3]
	mov	r5, fp
	bl	ECerr
	mov	r7, #0
	b	.L2
.L28:
	mov	r5, #0
	ldr	r2, .L31+24
	b	.L23
.L29:
	mov	r5, fp
	ldr	r2, .L31
	b	.L23
.L32:
	.align	2
.L31:
	.word	ERR_R_MALLOC_FAILURE
	.word	EC_FLAG_COFACTOR_ECDH
	.word	EC_R_MISSING_PRIVATE_KEY
	.word	EC_F_ECDH_SIMPLE_COMPUTE_KEY
	.word	EC_R_POINT_ARITHMETIC_FAILURE
	.word	ERR_R_BN_LIB
	.word	ERR_R_INTERNAL_ERROR
	.size	ecdh_simple_compute_key, .-ecdh_simple_compute_key
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_INTERNAL_ERROR,4,4
	.comm	ERR_R_BN_LIB,4,4
	.comm	EC_R_POINT_ARITHMETIC_FAILURE,4,4
	.comm	EC_R_MISSING_PRIVATE_KEY,4,4
	.comm	EC_F_ECDH_SIMPLE_COMPUTE_KEY,4,4
	.comm	EC_FLAG_COFACTOR_ECDH,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
