Home | History | Annotate | Line # | Download | only in aarch64
      1 #include "arm_arch.h"
      2 
      3 .text
      4 .arch	armv8-a+crypto
      5 
      6 .align	5
      7 .globl	_armv7_neon_probe
      8 .type	_armv7_neon_probe,%function
      9 _armv7_neon_probe:
     10 	orr	v15.16b, v15.16b, v15.16b
     11 	ret
     12 .size	_armv7_neon_probe,.-_armv7_neon_probe
     13 
     14 .globl	_armv7_tick
     15 .type	_armv7_tick,%function
     16 _armv7_tick:
     17 #ifdef	__APPLE__
     18 	mrs	x0, CNTPCT_EL0
     19 #else
     20 	mrs	x0, CNTVCT_EL0
     21 #endif
     22 	ret
     23 .size	_armv7_tick,.-_armv7_tick
     24 
     25 .globl	_armv8_aes_probe
     26 .type	_armv8_aes_probe,%function
     27 _armv8_aes_probe:
     28 	aese	v0.16b, v0.16b
     29 	ret
     30 .size	_armv8_aes_probe,.-_armv8_aes_probe
     31 
     32 .globl	_armv8_sha1_probe
     33 .type	_armv8_sha1_probe,%function
     34 _armv8_sha1_probe:
     35 	sha1h	s0, s0
     36 	ret
     37 .size	_armv8_sha1_probe,.-_armv8_sha1_probe
     38 
     39 .globl	_armv8_sha256_probe
     40 .type	_armv8_sha256_probe,%function
     41 _armv8_sha256_probe:
     42 	sha256su0	v0.4s, v0.4s
     43 	ret
     44 .size	_armv8_sha256_probe,.-_armv8_sha256_probe
     45 
     46 .globl	_armv8_pmull_probe
     47 .type	_armv8_pmull_probe,%function
     48 _armv8_pmull_probe:
     49 	pmull	v0.1q, v0.1d, v0.1d
     50 	ret
     51 .size	_armv8_pmull_probe,.-_armv8_pmull_probe
     52 
     53 .globl	_armv8_sha512_probe
     54 .type	_armv8_sha512_probe,%function
     55 _armv8_sha512_probe:
     56 .long	0xcec08000	// sha512su0	v0.2d,v0.2d
     57 	ret
     58 .size	_armv8_sha512_probe,.-_armv8_sha512_probe
     59 
     60 .globl	OPENSSL_cleanse
     61 .type	OPENSSL_cleanse,%function
     62 .align	5
     63 OPENSSL_cleanse:
     64 	cbz	x1,.Lret	// len==0?
     65 	cmp	x1,#15
     66 	b.hi	.Lot		// len>15
     67 	nop
     68 .Little:
     69 	strb	wzr,[x0],#1	// store byte-by-byte
     70 	subs	x1,x1,#1
     71 	b.ne	.Little
     72 .Lret:	ret
     73 
     74 .align	4
     75 .Lot:	tst	x0,#7
     76 	b.eq	.Laligned	// inp is aligned
     77 	strb	wzr,[x0],#1	// store byte-by-byte
     78 	sub	x1,x1,#1
     79 	b	.Lot
     80 
     81 .align	4
     82 .Laligned:
     83 	str	xzr,[x0],#8	// store word-by-word
     84 	sub	x1,x1,#8
     85 	tst	x1,#-8
     86 	b.ne	.Laligned	// len>=8
     87 	cbnz	x1,.Little	// len!=0?
     88 	ret
     89 .size	OPENSSL_cleanse,.-OPENSSL_cleanse
     90 
     91 .globl	CRYPTO_memcmp
     92 .type	CRYPTO_memcmp,%function
     93 .align	4
     94 CRYPTO_memcmp:
     95 	eor	w3,w3,w3
     96 	cbz	x2,.Lno_data	// len==0?
     97 	cmp	x2,#16
     98 	b.ne	.Loop_cmp
     99 	ldp	x8,x9,[x0]
    100 	ldp	x10,x11,[x1]
    101 	eor	x8,x8,x10
    102 	eor	x9,x9,x11
    103 	orr	x8,x8,x9
    104 	mov	x0,#1
    105 	cmp	x8,#0
    106 	csel	x0,xzr,x0,eq
    107 	ret
    108 
    109 .align	4
    110 .Loop_cmp:
    111 	ldrb	w4,[x0],#1
    112 	ldrb	w5,[x1],#1
    113 	eor	w4,w4,w5
    114 	orr	w3,w3,w4
    115 	subs	x2,x2,#1
    116 	b.ne	.Loop_cmp
    117 
    118 .Lno_data:
    119 	neg	w0,w3
    120 	lsr	w0,w0,#31
    121 	ret
    122 .size	CRYPTO_memcmp,.-CRYPTO_memcmp
    123