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