From 155a82d1fe1c50d859081ff67f26633b9d7dada8 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tomas@openssl.org>
Date: Mon, 17 Oct 2022 17:05:09 +0200
Subject: [PATCH] Avoid putting ripemd_prov.c in libcommon otherwise it is
 regarded as fips source

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19375)
---
 crypto/ripemd/build.info                     | 8 ++++----
 providers/implementations/digests/build.info | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/crypto/ripemd/build.info b/crypto/ripemd/build.info
index 75a6cd5ff0..f050480de4 100644
--- a/crypto/ripemd/build.info
+++ b/crypto/ripemd/build.info
@@ -19,10 +19,10 @@ SOURCE[../../libcrypto]=rmd_dgst.c rmd_one.c $RMD160ASM
 DEFINE[../../libcrypto]=$RMD160DEF
 
 # When all deprecated symbols are removed, libcrypto doesn't export the
-# RIPEMD160 functions, so we must include them directly in libcommon.a
-IF[{- $disabled{'deprecated-3.0'} -}]
-  SOURCE[../../providers/libcommon.a]=rmd_dgst.c rmd_one.c $RMD160ASM
-  DEFINE[../../providers/libcommon.a]=$RMD160DEF
+# RIPEMD160 functions, so we must include them directly in liblegacy.a
+IF[{- $disabled{'deprecated-3.0'} && !$disabled{'module'} -}]
+  SOURCE[../../providers/liblegacy.a]=rmd_dgst.c rmd_one.c $RMD160ASM
+  DEFINE[../../providers/liblegacy.a]=$RMD160DEF
 ENDIF
 
 GENERATE[rmd-586.S]=asm/rmd-586.pl
diff --git a/providers/implementations/digests/build.info b/providers/implementations/digests/build.info
index 2d807416d6..d30975028e 100644
--- a/providers/implementations/digests/build.info
+++ b/providers/implementations/digests/build.info
@@ -15,7 +15,11 @@ $MD2_GOAL=../../liblegacy.a
 $MD4_GOAL=../../liblegacy.a
 $MDC2_GOAL=../../liblegacy.a
 $WHIRLPOOL_GOAL=../../liblegacy.a
-$RIPEMD_GOAL=$COMMON_GOAL
+IF[{- !$disabled{module} -}]
+  $RIPEMD_GOAL=../../libdefault.a ../../liblegacy.a
+ELSE
+  $RIPEMD_GOAL=../../libdefault.a
+ENDIF
 
 # This source is common for all digests in all our providers.
 SOURCE[$COMMON_GOAL]=digestcommon.c