diff options
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/Makefile | 44 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/Makefile.com | 69 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/amd64/Makefile | 32 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/decrypt.c | 70 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/i386/Makefile | 32 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/sparc/Makefile | 30 | ||||
| -rw-r--r-- | usr/src/cmd/cmd-crypto/decrypt/sparcv9/Makefile | 31 | ||||
| -rw-r--r-- | usr/src/pkgdefs/SUNWcsu/prototype_com | 4 | ||||
| -rw-r--r-- | usr/src/pkgdefs/SUNWcsu/prototype_i386 | 4 | ||||
| -rw-r--r-- | usr/src/pkgdefs/SUNWcsu/prototype_sparc | 4 |
10 files changed, 266 insertions, 54 deletions
diff --git a/usr/src/cmd/cmd-crypto/decrypt/Makefile b/usr/src/cmd/cmd-crypto/decrypt/Makefile index 3b767d7c03..2adbe4c928 100644 --- a/usr/src/cmd/cmd-crypto/decrypt/Makefile +++ b/usr/src/cmd/cmd-crypto/decrypt/Makefile @@ -19,39 +19,45 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -PROG = decrypt +PROG= decrypt +ROOTLINK= $(ROOTBIN)/encrypt +DCFILE=$(PROG).dc -OBJS = decrypt.o +include ../../Makefile.cmd -SRCS = $(OBJS:.o=.c) +SUBDIRS= $(MACH) +$(BUILD64)SUBDIRS += $(MACH64) -include ../../Makefile.cmd - -CFLAGS += $(CCVERBOSE) -D_FILE_OFFSET_BITS=64 - -LDLIBS += -lkmf -lpkcs11 -lcryptoutil +all := TARGET = all +install := TARGET = install +clean := TARGET = clean +clobber := TARGET = clobber +lint := TARGET = lint .KEEP_STATE: -all: $(PROG) +all clean clobber lint: $(SUBDIRS) -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(DYNFLAGS) - $(POST_PROCESS) +install: $(SUBDIRS) + -$(RM) $(ROOTPROG) $(ROOTLINK) + -$(LN) $(ISAEXEC) $(ROOTPROG) + -$(LN) $(ISAEXEC) $(ROOTLINK) -install: all $(ROOTPROG) - $(RM) $(ROOTBIN)/encrypt - $(LN) $(ROOTPROG) $(ROOTBIN)/encrypt +$(SUBDIRS): FRC + @cd $@; pwd; $(MAKE) $(TARGET) -clean: - $(RM) -f $(OBJS) $(PROG) +$(DCFILE): + $(RM) messages.po + $(XGETTEXT) $(XGETFLAGS) -t $(PROG).c + $(SED) -e '/^domain/d' messages.po > $@ + $(RM) messages.po -lint: lint_SRCS +FRC: include ../../Makefile.targ diff --git a/usr/src/cmd/cmd-crypto/decrypt/Makefile.com b/usr/src/cmd/cmd-crypto/decrypt/Makefile.com new file mode 100644 index 0000000000..adcb7d6f0b --- /dev/null +++ b/usr/src/cmd/cmd-crypto/decrypt/Makefile.com @@ -0,0 +1,69 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +PROG = decrypt + +ROOTLINK32= $(ROOTBIN32)/encrypt +ROOTLINK64= $(ROOTBIN64)/encrypt + +OBJS = decrypt.o + +SRCS = $(OBJS:%.o=../%.c) + +include ../../../Makefile.cmd + +CFLAGS += $(CCVERBOSE) +CFLAGS64 += $(CCVERBOSE) +CPPFLAGS += -D_FILE_OFFSET_BITS=64 + +LDLIBS += -lkmf -lpkcs11 -lcryptoutil + +.KEEP_STATE: + +all: $(PROG) + +lint: lint_SRCS + +include ../../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) $< + +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(DYNFLAGS) + $(POST_PROCESS) + +$(ROOTLINK32): $(ROOTPROG32) + $(RM) $@ + $(LN) $(ROOTPROG32) $@ + +$(ROOTLINK64): $(ROOTPROG64) + $(RM) $@ + $(LN) $(ROOTPROG64) $@ + +clean: + $(RM) $(PROG) $(OBJS) diff --git a/usr/src/cmd/cmd-crypto/decrypt/amd64/Makefile b/usr/src/cmd/cmd-crypto/decrypt/amd64/Makefile new file mode 100644 index 0000000000..cda7e442ac --- /dev/null +++ b/usr/src/cmd/cmd-crypto/decrypt/amd64/Makefile @@ -0,0 +1,32 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +include ../Makefile.com +include ../../../Makefile.cmd.64 + +install: all $(ROOTPROG64) $(ROOTLINK64) + diff --git a/usr/src/cmd/cmd-crypto/decrypt/decrypt.c b/usr/src/cmd/cmd-crypto/decrypt/decrypt.c index 6fd9e18042..b505390177 100644 --- a/usr/src/cmd/cmd-crypto/decrypt/decrypt.c +++ b/usr/src/cmd/cmd-crypto/decrypt/decrypt.c @@ -20,7 +20,7 @@ */ /* Portions Copyright 2005 Richard Lowe */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,28 +33,30 @@ * * One binary performs both encrypt/decrypt operation. * - * usage: - * - * algorithm - mechanism name without CKM_ prefix. Case - * does not matter - * keyfile - file containing key data. If not specified user is - * prompted to enter key. key length > 0 is required - * infile - input file to encrypt/decrypt. If omitted, stdin used. - * outfile - output file to encrypt/decrypt. If omitted, stdout used. - * if infile & outfile are same, a temp file is used for - * output and infile is replaced with this file after - * operation is complete. + * Usage: + * -a algorithm mechanism name without CKM_ prefix. Case + * does not matter + * -k keyfile file containing key data. If not specified user is + * prompted to enter key. key length > 0 is required + * -i infile input file to encrypt/decrypt. If omitted, stdin used. + * -o outfile output file to encrypt/decrypt. If omitted, stdout used. + * if infile & outfile are same, a temp file is used for + * output and infile is replaced with this file after + * operation is complete + * -l Display the list of algorithms + * -v Display verbose information + * -T tokenspec Specify a PKCS#11 token (optionally used with -K) + * -K keylabel Specify the symmetric PKCS#11 token key label * * Implementation notes: - * iv data - It is generated by random bytes equal to one block size. + * IV data - It is generated by random bytes equal to one block size. * - * encrypted output format - - * - Output format version number - 4 bytes in network byte order. - * - Iterations used in key gen function, 4 bytes in network byte order. - * - IV ( 'ivlen' bytes) + * Encrypted output format - + * - Output format version number (1) - 4 bytes in network byte order. + * - Iterations used in key gen function, 4 bytes in network byte order. + * - IV ('ivlen' bytes). Length is algorithm-dependent (see mech_aliases) * - Salt data used in key gen (16 bytes) - * - cipher text data. - * + * - Cipher text data (remainder of the file) */ #include <stdio.h> @@ -165,14 +167,14 @@ static boolean_t iflag = B_FALSE; /* -i <infile> flag, use stdin if absent */ static boolean_t oflag = B_FALSE; /* -o <outfile> flag, use stdout if absent */ static boolean_t lflag = B_FALSE; /* -l flag (list) */ static boolean_t vflag = B_FALSE; /* -v flag (verbose) */ -static boolean_t Tflag = B_FALSE; -static boolean_t Kflag = B_FALSE; +static boolean_t Tflag = B_FALSE; /* -T flag (tokenspec) */ +static boolean_t Kflag = B_FALSE; /* -K flag (keylabel) */ -static char *keyfile = NULL; /* name of keyfile */ -static char *inputfile = NULL; /* name of input file */ -static char *outputfile = NULL; /* name of output file */ -static char *token_label = NULL; -static char *key_label = NULL; +static char *keyfile = NULL; /* name of keyfile */ +static char *inputfile = NULL; /* name of input file */ +static char *outputfile = NULL; /* name of output file */ +static char *token_label = NULL; /* name of PKCS#11 token */ +static char *key_label = NULL; /* name of PKCS#11 token key label */ static int status_pos = 0; /* current position of progress bar element */ @@ -198,7 +200,7 @@ main(int argc, char **argv) boolean_t errflag = B_FALSE; (void) setlocale(LC_ALL, ""); -#if !defined(TEXT_DOMAIN) /* Should be defiend by cc -D */ +#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ #endif (void) textdomain(TEXT_DOMAIN); @@ -435,10 +437,10 @@ execute_cmd(struct CommandInfo *cmd, char *algo_str) boolean_t inoutsame = B_FALSE; /* if both input & output are same */ CK_BYTE_PTR pivbuf = NULL_PTR; CK_ULONG ivlen = 0L; - int mech_match = 0; - CK_ULONG iterations = CK_PKCS5_PBKD2_ITERATIONS; + int mech_match = 0; + uint32_t iterations = CK_PKCS5_PBKD2_ITERATIONS; CK_ULONG keylen; - int version = SUNW_ENCRYPT_FILE_VERSION; + uint32_t version = SUNW_ENCRYPT_FILE_VERSION; CK_KEY_TYPE keytype; KMF_RETURN kmfrv; CK_SLOT_ID token_slot_id; @@ -740,9 +742,11 @@ execute_cmd(struct CommandInfo *cmd, char *algo_str) case 1: /* * Version 1 output format: + * - Output format version 1 (4 bytes) * - Iterations used in key gen function (4 bytes) - * - IV ( 'ivlen' bytes) + * - IV ('ivlen' bytes). The length algorithm-dependent * - Salt data used in key gen (16 bytes) + * - Cipher text data (remainder of the file) * * An encrypted file has IV as first block (0 or * more bytes depending on mechanism) followed @@ -898,8 +902,8 @@ do_crypto: /* Write the version header encrypt command */ if (cmd->type == CKA_ENCRYPT) { /* convert to network order for storage */ - int netversion = htonl(version); - CK_ULONG netiter; + uint32_t netversion = htonl(version); + uint32_t netiter; if (write(outfd, &netversion, sizeof (netversion)) != sizeof (netversion)) { diff --git a/usr/src/cmd/cmd-crypto/decrypt/i386/Makefile b/usr/src/cmd/cmd-crypto/decrypt/i386/Makefile new file mode 100644 index 0000000000..a21411d6f1 --- /dev/null +++ b/usr/src/cmd/cmd-crypto/decrypt/i386/Makefile @@ -0,0 +1,32 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +include ../Makefile.com + +install: all $(ROOTPROG32) $(ROOTLINK32) + + diff --git a/usr/src/cmd/cmd-crypto/decrypt/sparc/Makefile b/usr/src/cmd/cmd-crypto/decrypt/sparc/Makefile new file mode 100644 index 0000000000..98a8635b7a --- /dev/null +++ b/usr/src/cmd/cmd-crypto/decrypt/sparc/Makefile @@ -0,0 +1,30 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +include ../Makefile.com + +install: all $(ROOTPROG32) $(ROOTLINK32) diff --git a/usr/src/cmd/cmd-crypto/decrypt/sparcv9/Makefile b/usr/src/cmd/cmd-crypto/decrypt/sparcv9/Makefile new file mode 100644 index 0000000000..f64fc5aeb9 --- /dev/null +++ b/usr/src/cmd/cmd-crypto/decrypt/sparcv9/Makefile @@ -0,0 +1,31 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +include ../Makefile.com +include ../../../Makefile.cmd.64 + +install: all $(ROOTPROG64) $(ROOTLINK64) diff --git a/usr/src/pkgdefs/SUNWcsu/prototype_com b/usr/src/pkgdefs/SUNWcsu/prototype_com index e863a53e77..483cc82a7b 100644 --- a/usr/src/pkgdefs/SUNWcsu/prototype_com +++ b/usr/src/pkgdefs/SUNWcsu/prototype_com @@ -93,7 +93,7 @@ f none usr/bin/ctwatch 555 root bin f none usr/bin/cut 555 root bin f none usr/bin/date 555 root bin f none usr/bin/dd 555 root bin -f none usr/bin/decrypt 555 root bin +l none usr/bin/decrypt=../../usr/lib/isaexec f none usr/bin/devattr 555 root bin f none usr/bin/devfree 555 root bin f none usr/bin/devreserv 555 root bin @@ -111,7 +111,7 @@ f none usr/bin/ed 555 root bin f none usr/bin/edit 555 root bin f none usr/bin/egrep 555 root bin f none usr/bin/eject 555 root bin -l none usr/bin/encrypt=../../usr/bin/decrypt +l none usr/bin/encrypt=../../usr/lib/isaexec f none usr/bin/env 555 root bin l none usr/bin/ex=../../usr/bin/edit f none usr/bin/expr 555 root bin diff --git a/usr/src/pkgdefs/SUNWcsu/prototype_i386 b/usr/src/pkgdefs/SUNWcsu/prototype_i386 index b99c681ed0..489ec29106 100644 --- a/usr/src/pkgdefs/SUNWcsu/prototype_i386 +++ b/usr/src/pkgdefs/SUNWcsu/prototype_i386 @@ -50,7 +50,9 @@ f none usr/bin/addbadsec 555 root bin f none usr/bin/i86/amt 555 root bin f none usr/bin/diskscan 555 root bin d none usr/bin/i86 755 root bin +f none usr/bin/i86/decrypt 555 root bin f none usr/bin/i86/digest 555 root bin +l none usr/bin/i86/encrypt=decrypt f none usr/bin/i86/ksh93 555 root bin f none usr/bin/i86/newtask 4555 root sys f none usr/bin/i86/nohup 555 root bin @@ -107,7 +109,9 @@ f none usr/sbin/i86/whodo 4555 root bin d none usr/bin/amd64 755 root bin f none usr/bin/amd64/amt 555 root bin f none usr/bin/amd64/crle 555 root bin +f none usr/bin/amd64/decrypt 555 root bin f none usr/bin/amd64/digest 555 root bin +l none usr/bin/amd64/encrypt=decrypt f none usr/bin/amd64/ksh93 555 root bin f none usr/bin/amd64/ls 555 root bin l none usr/bin/amd64/mac=digest diff --git a/usr/src/pkgdefs/SUNWcsu/prototype_sparc b/usr/src/pkgdefs/SUNWcsu/prototype_sparc index b3cce412c7..c5b6e38d06 100644 --- a/usr/src/pkgdefs/SUNWcsu/prototype_sparc +++ b/usr/src/pkgdefs/SUNWcsu/prototype_sparc @@ -50,12 +50,16 @@ d none usr/bin/sparcv7 755 root bin f none usr/bin/sparcv7/ksh93 555 root bin l none usr/bin/sparcv7/rksh93=ksh93 f none usr/bin/sparcv7/savecore 555 root bin +f none usr/bin/sparcv7/decrypt 555 root bin f none usr/bin/sparcv7/digest 555 root bin +l none usr/bin/sparcv7/encrypt=decrypt l none usr/bin/sparcv7/mac=digest d none usr/bin/sparcv9 755 root bin f none usr/bin/sparcv9/amt 555 root bin f none usr/bin/sparcv9/crle 555 root bin +f none usr/bin/sparcv9/decrypt 555 root bin f none usr/bin/sparcv9/digest 555 root bin +l none usr/bin/sparcv9/encrypt=decrypt f none usr/bin/sparcv9/ksh93 555 root bin f none usr/bin/sparcv9/ls 555 root bin l none usr/bin/sparcv9/mac=digest |
