xref: /illumos-gate/usr/src/tools/codesign/signproto.sh (revision 9b9d39d2a32ff806d2431dbcc50968ef1e6d46b2)
1#!/bin/ksh
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#
24# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27
28#
29# signproto cred_file
30#
31# Utility to find cryptographic modules in the proto area and
32# sign them using signit. Since the binaries have already been
33# signed (using development keys) during the build process,
34# we determine the correct signing credential to use based on
35# the existing signature. The cred_file argument contains a
36# list of signing server credentials and the corresponding
37# regular expressions to match against the file signatures.
38
39# Get absolute path of current directory; used later to invoke signit
40cd .
41dir=`dirname $0`
42dir=`[[ $dir = /* ]] && print $dir || print $PWD/$dir`
43
44findcrypto $1 | $dir/signit -i $ROOT -l ${CODESIGN_USER:-${LOGNAME}}
45stat=$?
46
47if [ $stat != 0 ]; then
48	echo "ERROR failure in signing operation"
49	exit $stat
50fi
51
52exit 0
53