Blame SOURCES/hobble-openssl

5820f5
#!/bin/sh
5820f5
5820f5
# Quit out if anything fails.
5820f5
set -e
5820f5
5820f5
# Clean out patent-or-otherwise-encumbered code.
5820f5
# MDC-2: 4,908,861 13/03/2007
5820f5
# IDEA:  5,214,703 25/05/2010
5820f5
# RC5:   5,724,428 03/03/2015
5820f5
# EC:    ????????? ??/??/2015
5820f5
5820f5
# Remove assembler portions of IDEA, MDC2, and RC5.
5820f5
(find crypto/{idea,mdc2,rc5}/asm -type f | xargs -r rm -fv)
5820f5
5820f5
# IDEA, MDC2, RC5, EC.
5820f5
for a in idea mdc2 rc5 ec ecdh ecdsa; do
5820f5
  for c in `find crypto/$a -name "*.c" -a \! -name "*test*" -type f` ; do
5820f5
	echo Destroying $c
5820f5
	> $c
5820f5
  done
5820f5
done
5820f5
5820f5
for c in `find crypto/evp -name "*_rc5.c" -o -name "*_idea.c" -o -name "*_mdc2.c" -o -name "*_ecdsa.c"`; do
5820f5
	echo Destroying $c
5820f5
	> $c
5820f5
done
5820f5
5820f5
for h in `find crypto ssl apps test -name "*.h"` ; do
5820f5
	echo Removing IDEA, MDC2, RC5, and EC references from $h
5820f5
	cat $h | \
5820f5
	awk    'BEGIN {ech=1;} \
5820f5
		/^#[ \t]*ifndef.*NO_IDEA/ {ech--; next;} \
5820f5
		/^#[ \t]*ifndef.*NO_MDC2/ {ech--; next;} \
5820f5
		/^#[ \t]*ifndef.*NO_RC5/ {ech--; next;} \
5820f5
		/^#[ \t]*ifndef.*NO_EC/ {ech--; next;} \
5820f5
		/^#[ \t]*ifndef.*NO_ECDH/ {ech--; next;} \
5820f5
		/^#[ \t]*ifndef.*NO_ECDSA/ {ech--; next;} \
5820f5
                /^#[ \t]*if/ {if(ech < 1) ech--;} \
5820f5
		{if(ech>0) {;print $0};} \
5820f5
		/^#[ \t]*endif/ {if(ech < 1) ech++;}' > $h.hobbled && \
5820f5
	mv $h.hobbled $h
5820f5
done
5820f5
5820f5
# Make the makefiles happy.
5820f5
touch crypto/rc5/asm/rc5-586.pl