Better check of DH parameters in TLS data
[oweals/openssl.git] / crypto / des / asm / dest4-sparcv9.pl
index 8a4c71009b09665992f367f7e2bf50172b6abebc..4a6e29fc5307eacc8f8267deca1a389c6c44c417 100644 (file)
@@ -1,4 +1,11 @@
-#!/usr/bin/env perl
+#! /usr/bin/env perl
+# Copyright 2013-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
+
 
 # ====================================================================
 # Written by David S. Miller <davem@devemloft.net> and Andy Polyakov
@@ -27,14 +34,17 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
 push(@INC,"${dir}","${dir}../../perlasm");
 require "sparcv9_modes.pl";
 
-&asm_init(@ARGV);
+$output=pop;
+open STDOUT,">$output";
+
+$code.=<<___;
+#include "sparc_arch.h"
 
-$code.=<<___ if ($::abibits==64);
+#ifdef __arch64__
 .register       %g2,#scratch
 .register       %g3,#scratch
-___
+#endif
 
-$code.=<<___;
 .text
 ___
 
@@ -94,6 +104,9 @@ $code.=<<___;
 .globl des_t4_cbc_encrypt
 .align 32
 des_t4_cbc_encrypt:
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .Lcbc_abort
+       srln            $len, 0, $len           ! needed on v8+, "nop" on v9
        ld              [$ivec + 0], %f0        ! load ivec
        ld              [$ivec + 4], %f1
 
@@ -165,6 +178,9 @@ des_t4_cbc_encrypt:
        st              %f0, [$ivec + 0]        ! write out ivec
        retl
        st              %f1, [$ivec + 4]
+.Lcbc_abort:
+       retl
+       nop
 
 .align 16
 2:     ldxa            [$inp]0x82, %g4         ! avoid read-after-write hazard
@@ -189,6 +205,9 @@ des_t4_cbc_encrypt:
 .globl des_t4_cbc_decrypt
 .align 32
 des_t4_cbc_decrypt:
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .Lcbc_abort
+       srln            $len, 0, $len           ! needed on v8+, "nop" on v9
        ld              [$ivec + 0], %f2        ! load ivec
        ld              [$ivec + 4], %f3
 
@@ -294,6 +313,9 @@ $code.=<<___;
 .globl des_t4_ede3_cbc_encrypt
 .align 32
 des_t4_ede3_cbc_encrypt:
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .Lcbc_abort
+       srln            $len, 0, $len           ! needed on v8+, "nop" on v9
        ld              [$ivec + 0], %f0        ! load ivec
        ld              [$ivec + 4], %f1
 
@@ -443,6 +465,9 @@ des_t4_ede3_cbc_encrypt:
 .globl des_t4_ede3_cbc_decrypt
 .align 32
 des_t4_ede3_cbc_decrypt:
+       cmp             $len, 0
+       be,pn           $::size_t_cc, .Lcbc_abort
+       srln            $len, 0, $len           ! needed on v8+, "nop" on v9
        ld              [$ivec + 0], %f2        ! load ivec
        ld              [$ivec + 4], %f3