	.file	"extr_ssl_lib.c_dane_tlsa_add.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	dane_tlsa_add, @function
dane_tlsa_add:
.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
	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, 56
	.cfi_def_cfa_offset 112
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	cmp	QWORD PTR 8[rdi], 0
	je	.L47
	mov	rbx, r9
	test	r9d, r9d
	js	.L4
	movsx	r15, r9d
	cmp	r15, r9
	je	.L5
.L4:
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_DATA_LENGTH[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
.L1:
	mov	rdx, QWORD PTR 40[rsp]
	xor	rdx, QWORD PTR fs:40
	jne	.L48
	add	rsp, 56
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L5:
	.cfi_restore_state
	cmp	QWORD PTR DANETLS_USAGE_LAST[rip], rsi
	mov	r12, rsi
	jl	.L49
	cmp	QWORD PTR DANETLS_SELECTOR_LAST[rip], rdx
	mov	r13, rdx
	jl	.L50
	cmp	QWORD PTR DANETLS_MATCHING_FULL[rip], rcx
	mov	rbp, rdi
	mov	r14, r8
	jne	.L51
.L8:
	test	r14, r14
	je	.L52
	mov	edi, 48
	mov	QWORD PTR 8[rsp], rcx
	call	OPENSSL_zalloc@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	mov	r15, rax
	je	.L43
	mov	QWORD PTR 16[rax], rcx
	mov	rdi, rbx
	mov	QWORD PTR [rax], r12
	mov	QWORD PTR 8[rax], r13
	mov	QWORD PTR 8[rsp], rcx
	call	OPENSSL_malloc@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	mov	QWORD PTR 40[r15], rax
	mov	rdi, rax
	je	.L44
	mov	rdx, rbx
	mov	rsi, r14
	mov	QWORD PTR 8[rsp], rcx
	call	memcpy@PLT
	mov	rcx, QWORD PTR 8[rsp]
	mov	QWORD PTR 24[r15], rbx
	cmp	QWORD PTR DANETLS_MATCHING_FULL[rip], rcx
	jne	.L13
	mov	QWORD PTR 16[rsp], r14
	mov	QWORD PTR 24[rsp], 0
	mov	QWORD PTR 32[rsp], 0
	cmp	r13, 128
	je	.L14
	cmp	r13, 129
	je	.L53
.L13:
	mov	rdi, QWORD PTR 8[rbp]
	mov	QWORD PTR 8[rsp], rcx
	call	sk_danetls_record_num@PLT
	mov	ebx, eax
	test	eax, eax
	jle	.L31
	mov	rcx, QWORD PTR 8[rsp]
	xor	r14d, r14d
	lea	rax, 0[0+rcx*8]
	mov	QWORD PTR 8[rsp], rax
.L28:
	mov	rdi, QWORD PTR 8[rbp]
	mov	esi, r14d
	call	sk_danetls_record_value@PLT
	cmp	QWORD PTR [rax], r12
	jg	.L27
	jl	.L26
	cmp	QWORD PTR 8[rax], r13
	jg	.L27
	jl	.L26
	mov	rcx, QWORD PTR 16[rbp]
	mov	rdx, QWORD PTR 8[rsp]
	mov	rax, QWORD PTR 16[rax]
	mov	rcx, QWORD PTR [rcx]
	mov	rdx, QWORD PTR [rcx+rdx]
	cmp	QWORD PTR [rcx+rax*8], rdx
	jg	.L27
.L26:
	mov	rdi, QWORD PTR 8[rbp]
	mov	edx, r14d
	mov	rsi, r15
	call	sk_danetls_record_insert@PLT
	test	eax, eax
	je	.L44
	mov	rdi, r12
	call	DANETLS_USAGE_BIT@PLT
	or	DWORD PTR 0[rbp], eax
	mov	eax, 1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L51:
	mov	rsi, rcx
	mov	QWORD PTR 8[rsp], rcx
	call	tlsa_md_get@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	mov	rdi, rax
	je	.L54
	mov	QWORD PTR 8[rsp], rcx
	call	EVP_MD_size@PLT
	mov	rcx, QWORD PTR 8[rsp]
	cmp	rax, r15
	je	.L8
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L27:
	add	r14d, 1
	cmp	ebx, r14d
	jne	.L28
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L47:
	mov	esi, DWORD PTR SSL_R_DANE_NOT_ENABLED[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	mov	eax, -1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L49:
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L44:
	mov	rdi, r15
	call	tlsa_free@PLT
.L43:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	mov	eax, -1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L50:
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_SELECTOR[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L53:
	lea	rsi, 16[rsp]
	lea	rdi, 24[rsp]
	mov	edx, ebx
	call	d2i_X509@PLT
	test	eax, eax
	je	.L45
	mov	rax, QWORD PTR 16[rsp]
	cmp	rax, r14
	jb	.L45
	sub	rax, r14
	mov	rcx, QWORD PTR 8[rsp]
	cmp	rax, rbx
	je	.L17
.L45:
	mov	rdi, r15
	call	tlsa_free@PLT
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_CERTIFICATE[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L14:
	lea	rsi, 16[rsp]
	lea	rdi, 32[rsp]
	mov	edx, ebx
	mov	QWORD PTR 8[rsp], rcx
	call	d2i_PUBKEY@PLT
	test	eax, eax
	je	.L23
	mov	rax, QWORD PTR 16[rsp]
	cmp	rax, r14
	jb	.L23
	sub	rax, r14
	mov	rcx, QWORD PTR 8[rsp]
	cmp	rax, rbx
	jne	.L23
	cmp	QWORD PTR DANETLS_USAGE_DANE_TA[rip], r12
	mov	rdi, QWORD PTR 32[rsp]
	jne	.L25
	mov	QWORD PTR 32[r15], rdi
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L52:
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_NULL_DATA[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L54:
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_MATCHING_TYPE[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rdi, r15
	call	tlsa_free@PLT
	mov	esi, DWORD PTR SSL_R_DANE_TLSA_BAD_PUBLIC_KEY[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	xor	eax, eax
	jmp	.L1
.L17:
	mov	rdi, QWORD PTR 24[rsp]
	mov	QWORD PTR 8[rsp], rcx
	call	X509_get0_pubkey@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	je	.L45
	mov	rdi, r12
	mov	QWORD PTR 8[rsp], rcx
	call	DANETLS_USAGE_BIT@PLT
	test	DWORD PTR DANETLS_TA_MASK[rip], eax
	mov	rcx, QWORD PTR 8[rsp]
	je	.L55
	mov	rdi, QWORD PTR 24[rbp]
	test	rdi, rdi
	je	.L56
.L21:
	mov	rsi, QWORD PTR 24[rsp]
	mov	QWORD PTR 8[rsp], rcx
	call	sk_X509_push@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	eax, eax
	jne	.L13
.L22:
	mov	esi, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edi, DWORD PTR SSL_F_DANE_TLSA_ADD[rip]
	call	SSLerr@PLT
	mov	rdi, QWORD PTR 24[rsp]
	call	X509_free@PLT
	mov	rdi, r15
	call	tlsa_free@PLT
	or	eax, -1
	jmp	.L1
.L25:
	mov	QWORD PTR 8[rsp], rcx
	call	EVP_PKEY_free@PLT
	mov	rcx, QWORD PTR 8[rsp]
	jmp	.L13
.L31:
	xor	r14d, r14d
	jmp	.L26
.L55:
	mov	rdi, QWORD PTR 24[rsp]
	call	X509_free@PLT
	mov	rcx, QWORD PTR 8[rsp]
	jmp	.L13
.L56:
	xor	eax, eax
	mov	QWORD PTR 8[rsp], rcx
	call	sk_X509_new_null@PLT
	mov	rcx, QWORD PTR 8[rsp]
	test	rax, rax
	mov	QWORD PTR 24[rbp], rax
	mov	rdi, rax
	jne	.L21
	jmp	.L22
.L48:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	dane_tlsa_add, .-dane_tlsa_add
	.comm	SSL_R_DANE_TLSA_NULL_DATA,4,4
	.comm	SSL_R_DANE_TLSA_BAD_SELECTOR,4,4
	.comm	SSL_R_DANE_TLSA_BAD_PUBLIC_KEY,4,4
	.comm	SSL_R_DANE_TLSA_BAD_MATCHING_TYPE,4,4
	.comm	SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH,4,4
	.comm	SSL_R_DANE_TLSA_BAD_DATA_LENGTH,4,4
	.comm	SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE,4,4
	.comm	SSL_R_DANE_TLSA_BAD_CERTIFICATE,4,4
	.comm	SSL_R_DANE_NOT_ENABLED,4,4
	.comm	SSL_F_DANE_TLSA_ADD,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	DANETLS_USAGE_LAST,8,8
	.comm	DANETLS_USAGE_DANE_TA,8,8
	.comm	DANETLS_TA_MASK,4,4
	.comm	DANETLS_SELECTOR_LAST,8,8
	.comm	DANETLS_MATCHING_FULL,8,8
	.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_ssl_lib.c_dane_tlsa_add.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	dane_tlsa_add, %function
dane_tlsa_add:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	ip, [r0, #4]
	mov	r5, r3
	ldr	r3, .L51
	sub	sp, sp, #20
	cmp	ip, #0
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	ldr	r8, [sp, #56]
	ldr	r9, [sp, #60]
	ldreq	r2, .L51+4
	beq	.L42
	cmp	r9, #0
	ldrlt	r2, .L51+8
	blt	.L44
	ldr	r3, .L51+12
	mov	r6, r1
	ldr	r3, [r3]
	cmp	r3, r1
	ldrlt	r2, .L51+16
	blt	.L44
	ldr	r3, .L51+20
	mov	r7, r2
	ldr	r3, [r3]
	cmp	r3, r2
	ldrlt	r2, .L51+24
	blt	.L44
	ldr	fp, .L51+28
	mov	r4, r0
	ldr	r3, [fp]
	cmp	r3, r5
	beq	.L7
	mov	r1, r5
	bl	tlsa_md_get
	subs	r10, r0, #0
	ldreq	r2, .L51+32
	beq	.L44
	bl	EVP_MD_size
	cmp	r0, r9
	ldrne	r2, .L51+36
	bne	.L44
.L7:
	cmp	r8, #0
	ldreq	r2, .L51+40
	beq	.L44
	mov	r0, #24
	bl	OPENSSL_zalloc
	subs	r10, r0, #0
	beq	.L43
	mov	r0, r9
	stm	r10, {r6, r7}
	str	r5, [r10, #8]
	bl	OPENSSL_malloc
	cmp	r0, #0
	str	r0, [r10, #20]
	beq	.L45
	mov	r2, r9
	mov	r1, r8
	bl	memcpy
	ldr	r3, [fp]
	str	r9, [r10, #12]
	cmp	r3, r5
	bne	.L12
	mov	r3, #0
	cmp	r7, #128
	str	r8, [sp]
	str	r3, [sp, #4]
	str	r3, [sp, #8]
	beq	.L13
	cmp	r7, #129
	bne	.L12
	mov	r2, r9
	mov	r1, sp
	add	r0, sp, #4
	bl	d2i_X509
	cmp	r0, #0
	beq	.L46
	ldr	r0, [sp]
	cmp	r0, r8
	bcc	.L46
	sub	r0, r0, r8
	cmp	r0, r9
	beq	.L16
.L46:
	mov	r0, r10
	bl	tlsa_free
	ldr	r2, .L51+44
.L44:
	ldr	r3, .L51+48
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	SSLerr
	mov	r0, #0
.L1:
	ldr	r3, .L51
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L48
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L45:
	mov	r0, r10
	bl	tlsa_free
.L43:
	ldr	r2, .L51+52
.L42:
	ldr	r3, .L51+48
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	SSLerr
	mvn	r0, #0
	b	.L1
.L13:
	mov	r2, r9
	mov	r1, sp
	add	r0, sp, #8
	bl	d2i_PUBKEY
	cmp	r0, #0
	beq	.L22
	ldr	r0, [sp]
	cmp	r0, r8
	bcc	.L22
	sub	r0, r0, r8
	cmp	r0, r9
	bne	.L22
	ldr	r3, .L51+56
	ldr	r0, [sp, #8]
	ldr	r3, [r3]
	cmp	r3, r6
	streq	r0, [r10, #16]
	beq	.L12
	bl	EVP_PKEY_free
.L12:
	ldr	r0, [r4, #4]
	bl	sk_danetls_record_num
	subs	r8, r0, #0
	mov	r9, #0
	ble	.L25
	lsl	r5, r5, #2
.L27:
	mov	r1, r9
	ldr	r0, [r4, #4]
	bl	sk_danetls_record_value
	ldr	r3, [r0]
	cmp	r3, r6
	bgt	.L26
	blt	.L25
	ldr	r3, [r0, #4]
	cmp	r3, r7
	bgt	.L26
	blt	.L25
	ldr	r3, [r4, #8]
	ldr	r2, [r0, #8]
	ldr	r3, [r3]
	ldr	r2, [r3, r2, lsl #2]
	ldr	r3, [r3, r5]
	cmp	r2, r3
	bgt	.L26
.L25:
	mov	r2, r9
	mov	r1, r10
	ldr	r0, [r4, #4]
	bl	sk_danetls_record_insert
	cmp	r0, #0
	beq	.L45
	mov	r0, r6
	bl	DANETLS_USAGE_BIT
	mov	r2, r0
	ldr	r3, [r4]
	mov	r0, #1
	orr	r3, r3, r2
	str	r3, [r4]
	b	.L1
.L26:
	add	r9, r9, #1
	cmp	r8, r9
	bne	.L27
	b	.L25
.L22:
	mov	r0, r10
	bl	tlsa_free
	ldr	r2, .L51+60
	b	.L44
.L16:
	ldr	r0, [sp, #4]
	bl	X509_get0_pubkey
	cmp	r0, #0
	beq	.L46
	mov	r0, r6
	bl	DANETLS_USAGE_BIT
	ldr	r3, .L51+64
	ldr	r3, [r3]
	tst	r0, r3
	beq	.L49
	ldr	r0, [r4, #12]
	cmp	r0, #0
	beq	.L50
.L20:
	ldr	r1, [sp, #4]
	bl	sk_X509_push
	cmp	r0, #0
	bne	.L12
.L21:
	ldr	r2, .L51+52
	ldr	r3, .L51+48
	ldr	r1, [r2]
	ldr	r0, [r3]
	bl	SSLerr
	ldr	r0, [sp, #4]
	bl	X509_free
	mov	r0, r10
	bl	tlsa_free
	mvn	r0, #0
	b	.L1
.L49:
	ldr	r0, [sp, #4]
	bl	X509_free
	b	.L12
.L50:
	bl	sk_X509_new_null
	cmp	r0, #0
	str	r0, [r4, #12]
	bne	.L20
	b	.L21
.L48:
	bl	__stack_chk_fail
.L52:
	.align	2
.L51:
	.word	.LC0
	.word	SSL_R_DANE_NOT_ENABLED
	.word	SSL_R_DANE_TLSA_BAD_DATA_LENGTH
	.word	DANETLS_USAGE_LAST
	.word	SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE
	.word	DANETLS_SELECTOR_LAST
	.word	SSL_R_DANE_TLSA_BAD_SELECTOR
	.word	DANETLS_MATCHING_FULL
	.word	SSL_R_DANE_TLSA_BAD_MATCHING_TYPE
	.word	SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH
	.word	SSL_R_DANE_TLSA_NULL_DATA
	.word	SSL_R_DANE_TLSA_BAD_CERTIFICATE
	.word	SSL_F_DANE_TLSA_ADD
	.word	ERR_R_MALLOC_FAILURE
	.word	DANETLS_USAGE_DANE_TA
	.word	SSL_R_DANE_TLSA_BAD_PUBLIC_KEY
	.word	DANETLS_TA_MASK
	.size	dane_tlsa_add, .-dane_tlsa_add
	.comm	SSL_R_DANE_TLSA_NULL_DATA,4,4
	.comm	SSL_R_DANE_TLSA_BAD_SELECTOR,4,4
	.comm	SSL_R_DANE_TLSA_BAD_PUBLIC_KEY,4,4
	.comm	SSL_R_DANE_TLSA_BAD_MATCHING_TYPE,4,4
	.comm	SSL_R_DANE_TLSA_BAD_DIGEST_LENGTH,4,4
	.comm	SSL_R_DANE_TLSA_BAD_DATA_LENGTH,4,4
	.comm	SSL_R_DANE_TLSA_BAD_CERTIFICATE_USAGE,4,4
	.comm	SSL_R_DANE_TLSA_BAD_CERTIFICATE,4,4
	.comm	SSL_R_DANE_NOT_ENABLED,4,4
	.comm	SSL_F_DANE_TLSA_ADD,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	DANETLS_USAGE_LAST,4,4
	.comm	DANETLS_USAGE_DANE_TA,4,4
	.comm	DANETLS_TA_MASK,4,4
	.comm	DANETLS_SELECTOR_LAST,4,4
	.comm	DANETLS_MATCHING_FULL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
