Improve the usability of the ca app using EdDSA
[openssl.git] / crypto / armv4cpuid.pl
index 1c447187c74e680af71b4bfa80b5403d54ae200c..ab007c19c3cd0c2caf9e16e50649cc4b76df8ae1 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
+# https://www.openssl.org/source/license.html
+
 
 $flavour = shift;
 $output  = shift;
@@ -15,7 +22,13 @@ $code.=<<___;
 #include "arm_arch.h"
 
 .text
+#if defined(__thumb2__) && !defined(__APPLE__)
+.syntax        unified
+.thumb
+#else
 .code  32
+#undef __thumb2__
+#endif
 
 .align 5
 .global        OPENSSL_atomic_add
@@ -59,6 +72,9 @@ OPENSSL_atomic_add:
 OPENSSL_cleanse:
        eor     ip,ip,ip
        cmp     r1,#7
+#ifdef __thumb2__
+       itt     hs
+#endif
        subhs   r1,r1,#4
        bhs     .Lot
        cmp     r1,#0
@@ -90,6 +106,36 @@ OPENSSL_cleanse:
 #endif
 .size  OPENSSL_cleanse,.-OPENSSL_cleanse
 
+.global        CRYPTO_memcmp
+.type  CRYPTO_memcmp,%function
+.align 4
+CRYPTO_memcmp:
+       eor     ip,ip,ip
+       cmp     r2,#0
+       beq     .Lno_data
+       stmdb   sp!,{r4,r5}
+
+.Loop_cmp:
+       ldrb    r4,[r0],#1
+       ldrb    r5,[r1],#1
+       eor     r4,r4,r5
+       orr     ip,ip,r4
+       subs    r2,r2,#1
+       bne     .Loop_cmp
+
+       ldmia   sp!,{r4,r5}
+.Lno_data:
+       rsb     r0,ip,#0
+       mov     r0,r0,lsr#31
+#if __ARM_ARCH__>=5
+       bx      lr
+#else
+       tst     lr,#1
+       moveq   pc,lr
+       .word   0xe12fff1e      @ bx    lr
+#endif
+.size  CRYPTO_memcmp,.-CRYPTO_memcmp
+
 #if __ARM_MAX_ARCH__>=7
 .arch  armv7-a
 .fpu   neon
@@ -116,27 +162,43 @@ _armv7_tick:
 .global        _armv8_aes_probe
 .type  _armv8_aes_probe,%function
 _armv8_aes_probe:
+#if defined(__thumb2__) && !defined(__APPLE__)
+       .byte   0xb0,0xff,0x00,0x03     @ aese.8        q0,q0
+#else
        .byte   0x00,0x03,0xb0,0xf3     @ aese.8        q0,q0
+#endif
        bx      lr
 .size  _armv8_aes_probe,.-_armv8_aes_probe
 
 .global        _armv8_sha1_probe
 .type  _armv8_sha1_probe,%function
 _armv8_sha1_probe:
+#if defined(__thumb2__) && !defined(__APPLE__)
+       .byte   0x00,0xef,0x40,0x0c     @ sha1c.32      q0,q0,q0
+#else
        .byte   0x40,0x0c,0x00,0xf2     @ sha1c.32      q0,q0,q0
+#endif
        bx      lr
 .size  _armv8_sha1_probe,.-_armv8_sha1_probe
 
 .global        _armv8_sha256_probe
 .type  _armv8_sha256_probe,%function
 _armv8_sha256_probe:
+#if defined(__thumb2__) && !defined(__APPLE__)
+       .byte   0x00,0xff,0x40,0x0c     @ sha256h.32    q0,q0,q0
+#else
        .byte   0x40,0x0c,0x00,0xf3     @ sha256h.32    q0,q0,q0
+#endif
        bx      lr
 .size  _armv8_sha256_probe,.-_armv8_sha256_probe
 .global        _armv8_pmull_probe
 .type  _armv8_pmull_probe,%function
 _armv8_pmull_probe:
+#if defined(__thumb2__) && !defined(__APPLE__)
+       .byte   0xa0,0xef,0x00,0x0e     @ vmull.p64     q0,d0,d0
+#else
        .byte   0x00,0x0e,0xa0,0xf2     @ vmull.p64     q0,d0,d0
+#endif
        bx      lr
 .size  _armv8_pmull_probe,.-_armv8_pmull_probe
 #endif