xref: /titanic_51/usr/src/tools/codesign/signproto.sh (revision 597bd30ba830d1e11c8efdb9a1b9de28e0599f5e)
123259b79Srotondo#!/bin/ksh
223259b79Srotondo#
323259b79Srotondo# CDDL HEADER START
423259b79Srotondo#
523259b79Srotondo# The contents of this file are subject to the terms of the
623259b79Srotondo# Common Development and Distribution License (the "License").
723259b79Srotondo# You may not use this file except in compliance with the License.
823259b79Srotondo#
923259b79Srotondo# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1023259b79Srotondo# or http://www.opensolaris.org/os/licensing.
1123259b79Srotondo# See the License for the specific language governing permissions
1223259b79Srotondo# and limitations under the License.
1323259b79Srotondo#
1423259b79Srotondo# When distributing Covered Code, include this CDDL HEADER in each
1523259b79Srotondo# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1623259b79Srotondo# If applicable, add the following below this CDDL HEADER, with the
1723259b79Srotondo# fields enclosed by brackets "[]" replaced with your own identifying
1823259b79Srotondo# information: Portions Copyright [yyyy] [name of copyright owner]
1923259b79Srotondo#
2023259b79Srotondo# CDDL HEADER END
2123259b79Srotondo#
22*597bd30bSMike Kupfer
2323259b79Srotondo#
24*597bd30bSMike Kupfer# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
2523259b79Srotondo# Use is subject to license terms.
2623259b79Srotondo#
2723259b79Srotondo
28*597bd30bSMike Kupfer#
2923259b79Srotondo# signproto cred_file
3023259b79Srotondo#
3123259b79Srotondo# Utility to find cryptographic modules in the proto area and
3223259b79Srotondo# sign them using signit. Since the binaries have already been
3323259b79Srotondo# signed (using development keys) during the build process,
3423259b79Srotondo# we determine the correct signing credential to use based on
3523259b79Srotondo# the existing signature. The cred_file argument contains a
3623259b79Srotondo# list of signing server credentials and the corresponding
3723259b79Srotondo# regular expressions to match against the file signatures.
3823259b79Srotondo
3923259b79Srotondo# Get absolute path of current directory; used later to invoke signit
4023259b79Srotondocd .
4123259b79Srotondodir=`dirname $0`
4223259b79Srotondodir=`[[ $dir = /* ]] && print $dir || print $PWD/$dir`
4323259b79Srotondo
44*597bd30bSMike Kupferfindcrypto $1 | $dir/signit -i $ROOT -l ${CODESIGN_USER:-${LOGNAME}}
45*597bd30bSMike Kupferstat=$?
4623259b79Srotondo
47*597bd30bSMike Kupferif [ $stat != 0 ]; then
482210853dSjohnz	echo "ERROR failure in signing operation"
49*597bd30bSMike Kupfer	exit $stat
502210853dSjohnzfi
51*597bd30bSMike Kupfer
52*597bd30bSMike Kupferexit 0
53