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