📄 pkcs11_startup.bash
字号:
# terms of this Agreement, and without further action by the# parties hereto, such provision shall be reformed to the# minimum extent necessary to make such provision valid and# enforceable.### If Recipient institutes patent litigation against a# Contributor with respect to a patent applicable to# software (including a cross-claim or counterclaim in a# lawsuit), then any patent licenses granted by that# Contributor to such Recipient under this Agreement shall# terminate as of the date such litigation is filed. In# addition, If Recipient institutes patent litigation# against any entity (including a cross-claim or# counterclaim in a lawsuit) alleging that the Program# itself (excluding combinations of the Program with other# software or hardware) infringes such Recipient's# patent(s), then such Recipient's rights granted under# Section 2(b) shall terminate as of the date such# litigation is filed.## All Recipient's rights under this Agreement shall# terminate if it fails to comply with any of the material# terms or conditions of this Agreement and does not cure# such failure in a reasonable period of time after becoming# aware of such noncompliance. If all Recipient's rights# under this Agreement terminate, Recipient agrees to cease# use and distribution of the Program as soon as reasonably# practicable. However, Recipient's obligations under this# Agreement and any licenses granted by Recipient relating# to the Program shall continue and survive. ## Everyone is permitted to copy and distribute copies of# this Agreement, but in order to avoid inconsistency the# Agreement is copyrighted and may only be modified in the# following manner. The Agreement Steward reserves the right# to publish new versions (including revisions) of this# Agreement from time to time. No one other than the# Agreement Steward has the right to modify this Agreement.## IBM is the initial Agreement Steward. IBM may assign the# responsibility to serve as the Agreement Steward to a# suitable separate entity. Each new version of the# Agreement will be given a distinguishing version number.# The Program (including Contributions) may always be# distributed subject to the version of the Agreement under# which it was received. In addition, after a new version of# the Agreement is published, Contributor may elect to# distribute the Program (including its Contributions) under# the new version. Except as expressly stated in Sections# 2(a) and 2(b) above, Recipient receives no rights or# licenses to the intellectual property of any Contributor# under this Agreement, whether expressly, by implication,# estoppel or otherwise. All rights in the Program not# expressly granted under this Agreement are reserved.### This Agreement is governed by the laws of the State of New# York and the intellectual property laws of the United# States of America. No party to this Agreement will bring a# legal action under this Agreement more than one year after# the cause of action arose. Each party waives its rights to# a jury trial in any resulting litigation. ####*/##/* (C) COPYRIGHT International Business Machines Corp. 2001 */# this is the Linux and NON-ODM startup script# Get the operating System.... Everything else falls into that# Get a list of crypto adapters and set error code to 0CARDS=`ls /dev/crypt* 2>/dev/null | sed s?\/dev\/??g 2>/dev/null`ERRORS=0STATCOMMAND=/usr/lib/pkcs11/methods/4758_statusSTDLLDIR=/usr/lib/pkcs11/stdllMETHDIR=/usr/lib/pkcs11/methodsCONFDIR=/etc/pkcs11CONFFILE=pk_config_dataGROUPADD=/usr/sbin/groupaddUSERMOD=/usr/sbin/usermodID=/usr/bin/idrm -f $CONFDIR/$CONFFILE >/dev/null 2>&1 # always whack the entire config file and build # it from scratch# Create the pkcs11 group if it does not exist...cat /etc/group|grep pkcs11 >/dev/null 2>&1rc=$?if [ $rc = 1 ]then if [ -x $GROUPADD ] then $GROUPADD pkcs11 >/dev/null 2>&1 else echo "Couldn't execute $GROUPADD. Please add the group 'pkcs11' manually." fifiif [ -x $USERMOD -a -x $ID ]then # add the pkcs group # replace spaces by commas $USERMOD -G $( $ID --groups --name root | /bin/sed -e 'y/ /,/'),pkcs11 rootelse echo "Couldn't execute $USERMOD. Please add root to the group 'pkcs11' manually."fi# For each card run the status command and if successful# create the odm stanza for the fileif [ -x $STATCOMMAND ]thenfor i in $CARDSdo $METHDIR/4758_status -c $i RC=$? if [ $RC = 101 ] then # need to make this the minor number of the device only x=`ls -l /dev/$i | awk '{ print $6 }'` $METHDIR/pkcs_slot $x deep elif [ $RC = 102 ] then # SAB XXX Need to get the groups created elsewhere # actually we should build the correlator list here # and pass the list in all at once x=`ls -l /dev/$i | awk '{ print $6 }'` if [ -z $CORRLIST ] then CORRLIST="${x}" else CORRLIST="${CORRLIST},${x}" fi fidonefi # For this we will always delete the SW tok from ODM and then# add it if the file exists....if [ -f $STDLLDIR/PKCS11_SW.so ]then $METHDIR/pkcs_slot 0 softfi# Addition for AEP Devicesif [ -f $STDLLDIR/PKCS11_AEP.so ]then /bin/cat /proc/devices | grep paep >/dev/null 2>&1 rc=$? if [ $rc = 0 ] then $METHDIR/pkcs_slot 0 aep fifi# Add the ICA device if it existsif [ -f $STDLLDIR/PKCS11_ICA.so ]then# This won't work if the driver is built into the kernel# so we will look for it in /proc/devices# /sbin/lsmod | grep devica >/dev/null 2>&1 /bin/cat /proc/devices | grep leedslite >/dev/null 2>&1 rc=$? if [ $rc = 0 ] then $METHDIR/pkcs_slot 0 ica else /bin/cat /proc/devices | grep z90crypt >/dev/null 2>&1 rc1=$? /bin/cat /proc/misc | grep z90crypt >/dev/null 2>&1 rc2=$? if [ $rc1 = 0 -o $rc2 = 0 ] then $METHDIR/pkcs_slot 0 ica fi fifi#add the broadcom deviceif [ -f $STDLLDIR/PKCS11_BC.so ]then /bin/cat /proc/devices | grep cryptonet >/dev/null 2>&1 rc=$? if [ $rc = 0 ] then $METHDIR/pkcs_slot 0 bcom fifi#add the Corrent deviceif [ -f $STDLLDIR/PKCS11_CR.so ]then /bin/cat /proc/misc | grep cr702x >/dev/null 2>&1 rc=$? if [ $rc = 0 ] then $METHDIR/pkcs_slot 0 cr fifiif [ $ERRORS -ne 0 ]then exit -1fiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -