1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#!/bin/sh
# This is a script which modifies MaraDNS to have no code which
# could be considered crypto code whatsoever. Useful for people who
# mirror MaraDNS in countries where crypto is illegal (e.g. France),
# and therefore can not have a secure random number generator
# Make sure they mean it
if [ "$1" != "yes_nuke_rng" ] ; then
echo if you really want to do this, run this as
echo $0 yes_nuke_rng
exit 1
fi
cd rng
rm -fr *
cat > Makefile << EOF
all:
echo no rng here
EOF
cd ../test
rm rngtest.c
cat > rngtest.c << EOF
main(){
printf("Removed by remove.rng script\n");
return 0;
}
EOF
cd ../tools/misc
cat > rnghash.c << EOF
main(){
printf("no rng\n");
return 0;
}
EOF
cd ../../server
cat MaraDNS.c | \
awk '/RNG USING CODE/ {np++}
$0 !~ /RNG USING CODE/ {if(np % 2 == 0){print}}' > foo
mv foo MaraDNS.c
cat recursive.c | \
awk '/RNG USING CODE/ {np++;
if(np == 6){
print " /* Since this is the non-rng version of MaraDNS, we "
print " do not even try to be secure */"
print " r_place++;"
print " r_place %= 0xfffe;"
print " ret = r_place;"
}
}
$0 !~ /RNG USING CODE/ {if(np % 2 == 0){print}}' > foo
mv foo recursive.c
cat Makefile | grep -v '^ROBJECT' > foo
mv foo Makefile
cd ../tools
cat askmara.c | \
awk '/RNG USING CODE/ {np++}
$0 !~ /RNG USING CODE/ {if(np % 2 == 0){print}}' > foo
mv foo askmara.c
cat Makefile | egrep -v '^ROBJECTS' > foo
mv foo Makefile
echo RNG code should now be gone
|