fd2893
#!/bin/sh
fd2893
fd2893
# Quit out if anything fails.
fd2893
set -e
fd2893
fd2893
# Clean out patent-or-otherwise-encumbered code.
fd2893
# MDC-2: 4,908,861 13/03/2007 - expired, we do not remove it but do not enable it anyway
fd2893
# IDEA:  5,214,703 07/01/2012 - expired, we do not remove it anymore
fd2893
# RC5:   5,724,428 01/11/2015 - expired, we do not remove it anymore
fd2893
# EC:    ????????? ??/??/2020
fd2893
# SRP:   ????????? ??/??/20??
fd2893
fd2893
# Remove assembler portions of IDEA, MDC2, and RC5.
fd2893
# (find crypto/rc5/asm -type f | xargs -r rm -fv)
fd2893
fd2893
# SRP.
fd2893
for a in srp; do
fd2893
  for c in `find crypto/$a -name "*.c" -a \! -name "*test*" -type f` ; do
fd2893
	echo Destroying $c
fd2893
	> $c
fd2893
  done
fd2893
done
fd2893
fd2893
for c in `find crypto/bn -name "*gf2m.c"`; do
fd2893
	echo Destroying $c
fd2893
	> $c
fd2893
done
fd2893
fd2893
for c in `find crypto/ec -name "ec2*.c" -o -name "ec_curve.c" -o -name "ecp_nistp22?.c" -o -name "ectest.c"`; do
fd2893
	echo Destroying $c
fd2893
	> $c
fd2893
done
fd2893
fd2893
for h in `find crypto ssl apps test -name "*.h"` ; do
fd2893
	echo Removing SRP and EC2M references from $h
fd2893
	cat $h | \
fd2893
	awk    'BEGIN {ech=1;} \
fd2893
		/^#[ \t]*ifndef.*NO_SRP/ {ech--; next;} \
fd2893
		/^#[ \t]*ifndef.*NO_EC2M/ {ech--; next;} \
fd2893
                /^#[ \t]*if/ {if(ech < 1) ech--;} \
fd2893
		{if(ech>0) {;print $0};} \
fd2893
		/^#[ \t]*endif/ {if(ech < 1) ech++;}' > $h.hobbled && \
fd2893
	mv $h.hobbled $h
fd2893
done
fd2893
fd2893
# Make the makefiles happy.
fd2893
# touch crypto/rc5/asm/rc5-586.pl