rind 0.1.2

Pure-Rust cryptography for MoQ, forked from graviola
Documentation
// Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Generated by admin/import-aws-lc from aws-lc 91c93a8eb860e51482a871a8772cb9b1b310baea:
// generated-src/linux-aarch64/crypto/fipsmodule/vpaes-armv8.S, which aws-lc generates from crypto/fipsmodule/aes/asm/vpaes-armv8.pl.
// Do not edit by hand.
	
	stp	x29,x30,[sp,#-16]!
	add	x29,sp,#0
	stp	d8,d9,[sp,#-16]!	// ABI spec says so
	stp	d10,d11,[sp,#-16]!
	stp	d12,d13,[sp,#-16]!
	stp	d14,d15,[sp,#-16]!

	cbz	x2, .Lvpaes_ctr32_done

	// Note, unlike the other functions, x2 here is measured in blocks,
	// not bytes.
	mov	x17, x2
	mov	x2,  x3

	// Load the IV and counter portion.
	ldr	w6, [x4, #12]
	ld1	{{v7.16b}}, [x4]

	bl	{vpaes_encrypt_preheat}
	tst	x17, #1
	rev	w6, w6		// The counter is big-endian.
	b.eq	.Lvpaes_ctr32_prep_loop

	// Handle one block so the remaining block count is even for
	// _vpaes_encrypt_2x.
	ld1	{{v6.16b}}, [x0], #16	// .Load input ahead of time
	bl	{vpaes_encrypt_core}
	eor	v0.16b, v0.16b, v6.16b	// XOR input and result
	st1	{{v0.16b}}, [x1], #16
	subs	x17, x17, #1
	// Update the counter.
	add	w6, w6, #1
	rev	w7, w6
	mov	v7.s[3], w7
	b.ls	.Lvpaes_ctr32_done

.Lvpaes_ctr32_prep_loop:
	// _vpaes_encrypt_core takes its input from v7, while _vpaes_encrypt_2x
	// uses v14 and v15.
	mov	v15.16b, v7.16b
	mov	v14.16b, v7.16b
	add	w6, w6, #1
	rev	w7, w6
	mov	v15.s[3], w7

.Lvpaes_ctr32_loop:
	ld1	{{v6.16b,v7.16b}}, [x0], #32	// .Load input ahead of time
	bl	{vpaes_encrypt_2x}
	eor	v0.16b, v0.16b, v6.16b		// XOR input and result
	eor	v1.16b, v1.16b, v7.16b		// XOR input and result (#2)
	st1	{{v0.16b,v1.16b}}, [x1], #32
	subs	x17, x17, #2
	// Update the counter.
	add	w7, w6, #1
	add	w6, w6, #2
	rev	w7, w7
	mov	v14.s[3], w7
	rev	w7, w6
	mov	v15.s[3], w7
	b.hi	.Lvpaes_ctr32_loop

.Lvpaes_ctr32_done:
	ldp	d14,d15,[sp],#16
	ldp	d12,d13,[sp],#16
	ldp	d10,d11,[sp],#16
	ldp	d8,d9,[sp],#16
	ldp	x29,x30,[sp],#16
	
	ret