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