Add solaris assembler fixes for legacy provider
authorShane Lontis <shane.lontis@oracle.com>
Fri, 1 May 2020 05:15:02 +0000 (15:15 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Sat, 2 May 2020 07:55:07 +0000 (17:55 +1000)
The legacy provider contains assembler references. Most code is automagically pulled in from the libcrypto - but the platform specific assembler functions will not be visible in the symbol table. Copying BNASM and DESASM into liblegacy seems to be a better solution than exposing platform specific function in libcrypto.num.

Added a missing call in the des_cbc code for sparc.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11697)

crypto/bn/build.info
crypto/des/build.info
providers/implementations/ciphers/cipher_des_hw.c

index 5e04ed00ad82607cdb279395eec19374e17ed697..a40bcdca0f513515cc69373121fa6425104d9229 100644 (file)
@@ -112,16 +112,18 @@ $COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
         bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_sqr.c \
         bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
         bn_x931p.c bn_intern.c bn_dh.c \
-        bn_rsa_fips186_4.c $BNDH $BNASM
-SOURCE[../../libcrypto]=$COMMON bn_print.c bn_err.c bn_srp.c
+        bn_rsa_fips186_4.c $BNDH
+SOURCE[../../libcrypto]=$COMMON $BNASM bn_print.c bn_err.c bn_srp.c
 IF[{- !$disabled{'deprecated-3.0'} -}]
   SOURCE[../../libcrypto]=bn_depr.c
 ENDIF
-SOURCE[../../providers/libfips.a]=$COMMON
+SOURCE[../../providers/libfips.a]=$COMMON $BNASM
+SOURCE[../../providers/liblegacy.a]=$BNASM
 # Implementations are now spread across several libraries, so the defines
 # need to be applied to all affected libraries and modules.
 DEFINE[../../libcrypto]=$BNDEF
 DEFINE[../../providers/libfips.a]=$BNDEF
+DEFINE[../../providers/liblegacy.a]=$BNDEF
 DEFINE[../../providers/libimplementations.a]=$BNDEF
 
 INCLUDE[../../libcrypto]=../../crypto/include
index 0e5fd171e292fa760ad7e1b48affd25944146223..eb0c75496bbd3a299f637063fd9f4b1129d9d660 100644 (file)
@@ -14,7 +14,7 @@ IF[{- !$disabled{asm} -}]
 ENDIF
 
 LIBS=../../libcrypto
-$COMMON=set_key.c ecb3_enc.c $DESASM
+$COMMON=set_key.c ecb3_enc.c
 $ALL=$COMMON\
      ecb_enc.c  cbc_enc.c \
      cfb64enc.c cfb64ede.c cfb_enc.c \
@@ -22,8 +22,10 @@ $ALL=$COMMON\
      str2key.c  pcbc_enc.c qud_cksm.c rand_key.c \
      fcrypt.c xcbc_enc.c cbc_cksm.c
 
-SOURCE[../../libcrypto]=$ALL
-SOURCE[../../providers/libfips.a]=$COMMON
+SOURCE[../../libcrypto]=$ALL $DESASM
+SOURCE[../../providers/libfips.a]=$COMMON $DESASM
+SOURCE[../../providers/liblegacy.a]=$DESASM
+
 DEFINE[../../libcrypto]=$DESDEF
 DEFINE[../../providers/libfips.a]=$DESDEF
 DEFINE[../../providers/liblegacy.a]=$DESDEF
index 7181c2290c1c5fe1842d1e63bb2fc5a1c1e5c284..f52bade45ee12cb162697d9f26c4d5aff92752d3 100644 (file)
@@ -65,7 +65,13 @@ static int cipher_hw_des_ecb_cipher(PROV_CIPHER_CTX *ctx, unsigned char *out,
 static int cipher_hw_des_cbc_cipher(PROV_CIPHER_CTX *ctx, unsigned char *out,
                                     const unsigned char *in, size_t len)
 {
-    DES_key_schedule *key = &(((PROV_DES_CTX *)ctx)->dks.ks);
+    PROV_DES_CTX *dctx = (PROV_DES_CTX *)ctx;
+    DES_key_schedule *key = &(dctx->dks.ks);
+
+    if (dctx->dstream.cbc != NULL) {
+        (*dctx->dstream.cbc) (in, out, len, key, ctx->iv);
+        return 1;
+    }
 
     while (len >= MAXCHUNK) {
         DES_ncbc_encrypt(in, out, MAXCHUNK, key, (DES_cblock *)ctx->iv,