	.file	"extr_statem_clnt.c_tls_construct_cke_gost.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	tls_construct_cke_gost, @function
tls_construct_cke_gost:
.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
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 328
	.cfi_def_cfa_offset 384
	mov	r14d, DWORD PTR NID_id_GostR3411_2012_256[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 312[rsp], rax
	xor	eax, eax
	mov	rax, QWORD PTR 16[rdi]
	mov	eax, DWORD PTR [rax]
	test	DWORD PTR SSL_aGOST12[rip], eax
	mov	rax, QWORD PTR 32[rdi]
	cmove	r14d, DWORD PTR NID_id_GostR3411_94[rip]
	mov	rdi, QWORD PTR [rax]
	test	rdi, rdi
	je	.L30
	mov	r15, rsi
	call	X509_get0_pubkey@PLT
	xor	esi, esi
	mov	edi, eax
	call	EVP_PKEY_CTX_new@PLT
	mov	r12, rax
	test	rax, rax
	je	.L31
	mov	edi, 32
	call	OPENSSL_malloc@PLT
	mov	ecx, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	r13, rax
	test	rax, rax
	je	.L27
	mov	rdi, r12
	call	EVP_PKEY_encrypt_init@PLT
	test	rax, rax
	jle	.L16
	mov	esi, 32
	mov	rdi, r13
	call	RAND_bytes@PLT
	test	rax, rax
	jle	.L16
	xor	eax, eax
	call	EVP_MD_CTX_new@PLT
	mov	rbx, rax
	test	rax, rax
	je	.L11
	mov	edi, r14d
	call	EVP_get_digestbynid@PLT
	mov	rdi, rbx
	mov	esi, eax
	call	EVP_DigestInit@PLT
	test	rax, rax
	jle	.L11
	mov	esi, DWORD PTR 28[rbp]
	mov	edx, DWORD PTR SSL3_RANDOM_SIZE[rip]
	mov	rdi, rbx
	call	EVP_DigestUpdate@PLT
	test	rax, rax
	jle	.L11
	mov	esi, DWORD PTR 24[rbp]
	mov	edx, DWORD PTR SSL3_RANDOM_SIZE[rip]
	mov	rdi, rbx
	call	EVP_DigestUpdate@PLT
	test	rax, rax
	jle	.L11
	lea	r14, 16[rsp]
	lea	rdx, 4[rsp]
	mov	rdi, rbx
	mov	rsi, r14
	call	EVP_DigestFinal_ex@PLT
	test	rax, rax
	jle	.L11
	mov	rdi, rbx
	call	EVP_MD_CTX_free@PLT
	mov	r9, r14
	mov	esi, -1
	mov	rdi, r12
	mov	ecx, DWORD PTR EVP_PKEY_CTRL_SET_IV[rip]
	mov	edx, DWORD PTR EVP_PKEY_OP_ENCRYPT[rip]
	mov	r8d, 8
	call	EVP_PKEY_CTX_ctrl@PLT
	test	rax, rax
	js	.L28
	lea	r14, 48[rsp]
	lea	rdx, 8[rsp]
	mov	rcx, r13
	mov	rdi, r12
	mov	r8d, 32
	mov	rsi, r14
	mov	QWORD PTR 8[rsp], 255
	call	EVP_PKEY_encrypt@PLT
	test	rax, rax
	jle	.L28
	mov	esi, DWORD PTR V_ASN1_SEQUENCE[rip]
	mov	rdi, r15
	or	esi, DWORD PTR V_ASN1_CONSTRUCTED[rip]
	call	WPACKET_put_bytes_u8@PLT
	test	eax, eax
	je	.L16
	mov	rdx, QWORD PTR 8[rsp]
	cmp	rdx, 127
	jbe	.L15
	mov	esi, 129
	mov	rdi, r15
	call	WPACKET_put_bytes_u8@PLT
	test	eax, eax
	je	.L16
	mov	rdx, QWORD PTR 8[rsp]
.L15:
	mov	rsi, r14
	mov	rdi, r15
	call	WPACKET_sub_memcpy_u8@PLT
	test	eax, eax
	je	.L16
	mov	rdi, r12
	call	EVP_PKEY_CTX_free@PLT
	mov	QWORD PTR 0[rbp], r13
	mov	eax, 1
	mov	QWORD PTR 8[rbp], 32
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	mov	ecx, DWORD PTR ERR_R_INTERNAL_ERROR[rip]
.L27:
	mov	edx, DWORD PTR SSL_F_TLS_CONSTRUCT_CKE_GOST[rip]
	mov	esi, DWORD PTR SSL_AD_INTERNAL_ERROR[rip]
	mov	rdi, rbp
	xor	ebx, ebx
	call	SSLfatal@PLT
.L7:
	mov	rdi, r12
	call	EVP_PKEY_CTX_free@PLT
	mov	esi, 32
	mov	rdi, r13
	call	OPENSSL_clear_free@PLT
	mov	rdi, rbx
	call	EVP_MD_CTX_free@PLT
	xor	eax, eax
.L1:
	mov	rcx, QWORD PTR 312[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L32
	add	rsp, 328
	.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
.L11:
	.cfi_restore_state
	mov	ecx, DWORD PTR ERR_R_INTERNAL_ERROR[rip]
	mov	edx, DWORD PTR SSL_F_TLS_CONSTRUCT_CKE_GOST[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR SSL_AD_INTERNAL_ERROR[rip]
	call	SSLfatal@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L30:
	mov	ecx, DWORD PTR SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER[rip]
	mov	edx, DWORD PTR SSL_F_TLS_CONSTRUCT_CKE_GOST[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR SSL_AD_HANDSHAKE_FAILURE[rip]
	call	SSLfatal@PLT
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L31:
	mov	ecx, DWORD PTR ERR_R_MALLOC_FAILURE[rip]
	mov	edx, DWORD PTR SSL_F_TLS_CONSTRUCT_CKE_GOST[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR SSL_AD_INTERNAL_ERROR[rip]
	call	SSLfatal@PLT
	xor	eax, eax
	jmp	.L1
.L28:
	mov	ecx, DWORD PTR SSL_R_LIBRARY_BUG[rip]
	jmp	.L27
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	tls_construct_cke_gost, .-tls_construct_cke_gost
	.comm	V_ASN1_SEQUENCE,4,4
	.comm	V_ASN1_CONSTRUCTED,4,4
	.comm	SSL_aGOST12,4,4
	.comm	SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER,4,4
	.comm	SSL_R_LIBRARY_BUG,4,4
	.comm	SSL_F_TLS_CONSTRUCT_CKE_GOST,4,4
	.comm	SSL_AD_INTERNAL_ERROR,4,4
	.comm	SSL_AD_HANDSHAKE_FAILURE,4,4
	.comm	SSL3_RANDOM_SIZE,4,4
	.comm	NID_id_GostR3411_94,4,4
	.comm	NID_id_GostR3411_2012_256,4,4
	.comm	EVP_PKEY_OP_ENCRYPT,4,4
	.comm	EVP_PKEY_CTRL_SET_IV,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_INTERNAL_ERROR,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_statem_clnt.c_tls_construct_cke_gost.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	tls_construct_cke_gost, %function
tls_construct_cke_gost:
	@ args = 0, pretend = 0, frame = 304
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r6, r0
	ldr	r2, [r0, #8]
	ldr	r3, .L35
	ldr	r0, [r2]
	ldr	r2, [r3]
	ldr	r3, .L35+4
	tst	r0, r2
	ldr	r8, [r3]
	ldrne	r3, .L35+8
	ldr	r2, .L35+12
	ldrne	r8, [r3]
	ldr	r3, [r6, #20]
	sub	sp, sp, #316
	ldr	r4, [r3]
	mov	r7, r1
	cmp	r4, #0
	ldr	r2, [r2]
	str	r2, [sp, #308]
	mov	r2,#0
	beq	.L32
	mov	r0, r4
	bl	X509_get0_pubkey
	mov	r1, #0
	bl	EVP_PKEY_CTX_new
	subs	r4, r0, #0
	beq	.L33
	mov	r0, #32
	bl	OPENSSL_malloc
	subs	r9, r0, #0
	ldreq	r3, .L35+16
	beq	.L28
	mov	r0, r4
	bl	EVP_PKEY_encrypt_init
	cmp	r0, #0
	ble	.L16
	mov	r1, #32
	mov	r0, r9
	bl	RAND_bytes
	cmp	r0, #0
	ble	.L16
	bl	EVP_MD_CTX_new
	subs	r5, r0, #0
	beq	.L11
	mov	r0, r8
	bl	EVP_get_digestbynid
	mov	r1, r0
	mov	r0, r5
	bl	EVP_DigestInit
	cmp	r0, #0
	ble	.L11
	ldr	r8, .L35+20
	mov	r0, r5
	ldr	r1, [r6, #16]
	ldr	r2, [r8]
	bl	EVP_DigestUpdate
	cmp	r0, #0
	ble	.L11
	mov	r0, r5
	ldr	r2, [r8]
	ldr	r1, [r6, #12]
	bl	EVP_DigestUpdate
	cmp	r0, #0
	ble	.L11
	mov	r0, r5
	add	r1, sp, #20
	add	r2, sp, #16
	bl	EVP_DigestFinal_ex
	cmp	r0, #0
	ble	.L11
	mov	r0, r5
	bl	EVP_MD_CTX_free
	mov	r1, #8
	add	r0, sp, #20
	ldr	r3, .L35+24
	ldr	r2, .L35+28
	str	r0, [sp, #4]
	str	r1, [sp]
	mov	r0, r4
	mvn	r1, #0
	ldr	r3, [r3]
	ldr	r2, [r2]
	bl	EVP_PKEY_CTX_ctrl
	cmp	r0, #0
	blt	.L30
	mov	r3, #32
	mov	ip, #255
	str	r3, [sp]
	mov	r0, r4
	mov	r3, r9
	add	r1, sp, #52
	add	r2, sp, #12
	str	ip, [sp, #12]
	bl	EVP_PKEY_encrypt
	cmp	r0, #0
	ble	.L30
	ldr	r2, .L35+32
	ldr	r3, .L35+36
	ldr	r1, [r2]
	ldr	r3, [r3]
	mov	r0, r7
	orr	r1, r1, r3
	bl	WPACKET_put_bytes_u8
	cmp	r0, #0
	beq	.L16
	ldr	r2, [sp, #12]
	cmp	r2, #127
	bls	.L15
	mov	r1, #129
	mov	r0, r7
	bl	WPACKET_put_bytes_u8
	cmp	r0, #0
	beq	.L16
	ldr	r2, [sp, #12]
.L15:
	mov	r0, r7
	add	r1, sp, #52
	bl	WPACKET_sub_memcpy_u8
	cmp	r0, #0
	beq	.L16
	mov	r0, r4
	bl	EVP_PKEY_CTX_free
	mov	r3, #32
	mov	r0, #1
	str	r9, [r6]
	str	r3, [r6, #4]
	b	.L1
.L16:
	ldr	r3, .L35+40
.L28:
	ldr	r2, .L35+44
	ldr	r1, .L35+48
	mov	r0, r6
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	bl	SSLfatal
	mov	r5, #0
.L7:
	mov	r0, r4
	bl	EVP_PKEY_CTX_free
	mov	r1, #32
	mov	r0, r9
	bl	OPENSSL_clear_free
	mov	r0, r5
	bl	EVP_MD_CTX_free
	mov	r0, #0
.L1:
	ldr	r3, .L35+12
	ldr	r2, [r3]
	ldr	r3, [sp, #308]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L34
	add	sp, sp, #316
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L11:
	ldr	r3, .L35+40
	ldr	r2, .L35+44
	ldr	r1, .L35+48
	mov	r0, r6
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	bl	SSLfatal
	b	.L7
.L32:
	ldr	r3, .L35+52
	ldr	r2, .L35+44
	ldr	r1, .L35+56
.L29:
	mov	r0, r6
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	r1, [r1]
	bl	SSLfatal
	mov	r0, r4
	b	.L1
.L33:
	ldr	r3, .L35+16
	ldr	r2, .L35+44
	ldr	r1, .L35+48
	b	.L29
.L30:
	ldr	r3, .L35+60
	b	.L28
.L34:
	bl	__stack_chk_fail
.L36:
	.align	2
.L35:
	.word	SSL_aGOST12
	.word	NID_id_GostR3411_94
	.word	NID_id_GostR3411_2012_256
	.word	.LC0
	.word	ERR_R_MALLOC_FAILURE
	.word	SSL3_RANDOM_SIZE
	.word	EVP_PKEY_CTRL_SET_IV
	.word	EVP_PKEY_OP_ENCRYPT
	.word	V_ASN1_SEQUENCE
	.word	V_ASN1_CONSTRUCTED
	.word	ERR_R_INTERNAL_ERROR
	.word	SSL_F_TLS_CONSTRUCT_CKE_GOST
	.word	SSL_AD_INTERNAL_ERROR
	.word	SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER
	.word	SSL_AD_HANDSHAKE_FAILURE
	.word	SSL_R_LIBRARY_BUG
	.size	tls_construct_cke_gost, .-tls_construct_cke_gost
	.comm	V_ASN1_SEQUENCE,4,4
	.comm	V_ASN1_CONSTRUCTED,4,4
	.comm	SSL_aGOST12,4,4
	.comm	SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER,4,4
	.comm	SSL_R_LIBRARY_BUG,4,4
	.comm	SSL_F_TLS_CONSTRUCT_CKE_GOST,4,4
	.comm	SSL_AD_INTERNAL_ERROR,4,4
	.comm	SSL_AD_HANDSHAKE_FAILURE,4,4
	.comm	SSL3_RANDOM_SIZE,4,4
	.comm	NID_id_GostR3411_94,4,4
	.comm	NID_id_GostR3411_2012_256,4,4
	.comm	EVP_PKEY_OP_ENCRYPT,4,4
	.comm	EVP_PKEY_CTRL_SET_IV,4,4
	.comm	ERR_R_MALLOC_FAILURE,4,4
	.comm	ERR_R_INTERNAL_ERROR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
