Fix potential access of null pointer (pp)
[openssl.git] / crypto / s390xcpuid.S
index 3efad5506bed687c0b9b9447e8a3b4d9bd544488..8859e9e64a917f5c40efda91e9f0e9fe0d1a3ef3 100644 (file)
@@ -1,4 +1,10 @@
 .text
 .text
+// Copyright 2009-2016 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
 
 .globl OPENSSL_s390x_facilities
 .type  OPENSSL_s390x_facilities,@function
 
 .globl OPENSSL_s390x_facilities
 .type  OPENSSL_s390x_facilities,@function
@@ -125,6 +131,33 @@ OPENSSL_cleanse:
        br      %r14
 .size  OPENSSL_cleanse,.-OPENSSL_cleanse
 
        br      %r14
 .size  OPENSSL_cleanse,.-OPENSSL_cleanse
 
+.globl CRYPTO_memcmp
+.type  CRYPTO_memcmp,@function
+.align 16
+CRYPTO_memcmp:
+#if !defined(__s390x__) && !defined(__s390x)
+       llgfr   %r4,%r4
+#endif
+       lghi    %r5,0
+       clgr    %r4,%r5
+       je      .Lno_data
+
+.Loop_cmp:
+       llgc    %r0,0(%r2)
+       la      %r2,1(%r2)
+       llgc    %r1,0(%r3)
+       la      %r3,1(%r3)
+       xr      %r1,%r0
+       or      %r5,%r1
+       brctg   %r4,.Loop_cmp
+
+       lnr     %r5,%r5
+       srl     %r5,31
+.Lno_data:
+       lgr     %r2,%r5
+       br      %r14
+.size  CRYPTO_memcmp,.-CRYPTO_memcmp
+
 .globl OPENSSL_instrument_bus
 .type  OPENSSL_instrument_bus,@function
 .align 16
 .globl OPENSSL_instrument_bus
 .type  OPENSSL_instrument_bus,@function
 .align 16