Home | History | Annotate | Download | only in common_files
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 # ident	"%Z%%M%	%I%	%E% SMI"
     27 
     28 while read src dest
     29 do
     30 	if [ ! -f $dest ] ; then
     31 		cp $src $dest
     32 	else
     33 
     34 		egrep '^arcfour' $dest > /dev/null 2>&1
     35 		if [ $? != 0 ]; then
     36 			rc4=`egrep '^arcfour' $src` 
     37 		fi
     38 		egrep '^ecc' $dest > /dev/null 2>&1
     39 		if [ $? != 0 ]; then
     40 			ecc=`egrep '^ecc' $src`
     41 		fi
     42 		egrep '^rsa' $dest > /dev/null 2>&1
     43 		if [ $? != 0 ]; then
     44 			rsa=`egrep '^rsa' $src`
     45 		fi
     46 		egrep '^sha2' $dest > /dev/null 2>&1
     47 		if [ $? != 0 ]; then
     48 			sha2=`egrep '^sha2' $src`
     49 		fi
     50 		egrep '^swrand' $dest > /dev/null 2>&1
     51 		if [ $? != 0 ]; then
     52 			swrand=`egrep '^swrand' $src`
     53 		fi
     54 		egrep '^md4' $dest > /dev/null 2>&1
     55 		if [ $? != 0 ]; then
     56 			md4=`egrep '^md4' $src`
     57 		fi
     58 		export ecc
     59 		export rsa
     60 		export rc4
     61 		export sha2
     62 		export swrand
     63 		export md4
     64 		nawk '/^# End SUNWcsr/ { \
     65 			if (ENVIRON["rc4"] != "") {print ENVIRON["rc4"]} \
     66 			if (ENVIRON["ecc"] != "") {print ENVIRON["ecc"]} \
     67 			if (ENVIRON["rsa"] != "") {print ENVIRON["rsa"]} \
     68 			if (ENVIRON["sha2"] != "") {print ENVIRON["sha2"]} \
     69 			if (ENVIRON["swrand"] != "") {print ENVIRON["swrand"]} \
     70 			if (ENVIRON["md4"] != "") {print ENVIRON["md4"]} \
     71 		     } \
     72 		     { print } \
     73 		' $dest > $dest.$$
     74 		mv $dest.$$ $dest
     75 
     76 		sed -e 's/CKM_BF_/CKM_BLOWFISH_/g' $dest > $dest.$$
     77 		mv $dest.$$ $dest
     78 
     79 		# Undo the old kernel CRYPTO_UNLIMITED module names
     80 		sed -e 's/^aes256:/aes:/' -e 's/^blowfish448:/blowfish:/' -e \
     81 		 's/^arcfour2048:/arcfour:/' $dest > $dest.$$
     82 		mv -f $dest.$$ $dest
     83 		
     84 
     85 	fi
     86 
     87 done
     88 exit 0
     89