diff options
Diffstat (limited to 'usr/src/man/man3ext')
-rw-r--r-- | usr/src/man/man3ext/Makefile | 236 | ||||
-rw-r--r-- | usr/src/man/man3ext/NOTE.3ext | 174 | ||||
-rw-r--r-- | usr/src/man/man3ext/SUNW_C_GetMechSession.3ext | 221 | ||||
-rw-r--r-- | usr/src/man/man3ext/auto_ef.3ext | 213 | ||||
-rw-r--r-- | usr/src/man/man3ext/crypt.3ext | 163 | ||||
-rw-r--r-- | usr/src/man/man3ext/demangle.3ext | 86 | ||||
-rw-r--r-- | usr/src/man/man3ext/ecb_crypt.3ext | 138 | ||||
-rw-r--r-- | usr/src/man/man3ext/efi_alloc_and_init.3ext | 249 | ||||
-rw-r--r-- | usr/src/man/man3ext/ld_support.3ext | 106 | ||||
-rw-r--r-- | usr/src/man/man3ext/md4.3ext | 138 | ||||
-rw-r--r-- | usr/src/man/man3ext/md5.3ext | 163 | ||||
-rw-r--r-- | usr/src/man/man3ext/read_vtoc.3ext | 187 | ||||
-rw-r--r-- | usr/src/man/man3ext/rtld_audit.3ext | 109 | ||||
-rw-r--r-- | usr/src/man/man3ext/rtld_db.3ext | 126 | ||||
-rw-r--r-- | usr/src/man/man3ext/sendfile.3ext | 287 | ||||
-rw-r--r-- | usr/src/man/man3ext/sendfilev.3ext | 318 | ||||
-rw-r--r-- | usr/src/man/man3ext/sha1.3ext | 143 | ||||
-rw-r--r-- | usr/src/man/man3ext/sha2.3ext | 240 | ||||
-rw-r--r-- | usr/src/man/man3ext/stdarg.3ext | 167 | ||||
-rw-r--r-- | usr/src/man/man3ext/tsalarm_get.3ext | 345 | ||||
-rw-r--r-- | usr/src/man/man3ext/varargs.3ext | 119 |
21 files changed, 3928 insertions, 0 deletions
diff --git a/usr/src/man/man3ext/Makefile b/usr/src/man/man3ext/Makefile new file mode 100644 index 0000000000..e280a8404f --- /dev/null +++ b/usr/src/man/man3ext/Makefile @@ -0,0 +1,236 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet +# at http://www.illumos.org/license/CDDL. +# + +# Copyright 2011, Richard Lowe + +include ../../Makefile.master + +MANSECT = 3ext + +MANFILES = NOTE.3ext \ + SUNW_C_GetMechSession.3ext \ + auto_ef.3ext \ + crypt.3ext \ + demangle.3ext \ + ecb_crypt.3ext \ + efi_alloc_and_init.3ext \ + ld_support.3ext \ + md4.3ext \ + md5.3ext \ + read_vtoc.3ext \ + rtld_audit.3ext \ + rtld_db.3ext \ + sendfile.3ext \ + sendfilev.3ext \ + sha1.3ext \ + sha2.3ext \ + stdarg.3ext \ + tsalarm_get.3ext \ + varargs.3ext + +MANSOFILES = DES_FAILED.3ext \ + MD4Final.3ext \ + MD4Init.3ext \ + MD4Update.3ext \ + MD5Final.3ext \ + MD5Init.3ext \ + MD5Update.3ext \ + SHA1Final.3ext \ + SHA1Init.3ext \ + SHA1Update.3ext \ + SHA256Final.3ext \ + SHA256Init.3ext \ + SHA256Update.3ext \ + SHA2Final.3ext \ + SHA2Init.3ext \ + SHA2Update.3ext \ + SHA384Final.3ext \ + SHA384Init.3ext \ + SHA384Update.3ext \ + SHA512Final.3ext \ + SHA512Init.3ext \ + SHA512Update.3ext \ + SUNW_C_KeyToObject.3ext \ + _NOTE.3ext \ + auto_ef_file.3ext \ + auto_ef_free.3ext \ + auto_ef_get_encoding.3ext \ + auto_ef_get_score.3ext \ + auto_ef_str.3ext \ + cbc_crypt.3ext \ + cplus_demangle.3ext \ + crypt_close.3ext \ + des_crypt.3ext \ + des_encrypt.3ext \ + des_setkey.3ext \ + des_setparity.3ext \ + efi_alloc_and_read.3ext \ + efi_free.3ext \ + efi_use_whole_disk.3ext \ + efi_write.3ext \ + encrypt.3ext \ + la_activity.3ext \ + la_amd64_pltenter.3ext \ + la_i86_pltenter.3ext \ + la_objfilter.3ext \ + la_objopen.3ext \ + la_objsearch.3ext \ + la_pltexit.3ext \ + la_pltexit64.3ext \ + la_preinit.3ext \ + la_sparcv8_pltenter.3ext \ + la_sparcv9_pltenter.3ext \ + la_symbind32.3ext \ + la_symbind64.3ext \ + la_version.3ext \ + ld_atexit.3ext \ + ld_atexit64.3ext \ + ld_file.3ext \ + ld_file64.3ext \ + ld_input_done.3ext \ + ld_input_section.3ext \ + ld_input_section64.3ext \ + ld_open.3ext \ + ld_open64.3ext \ + ld_section.3ext \ + ld_section64.3ext \ + ld_start.3ext \ + ld_start64.3ext \ + ld_version.3ext \ + md5_calc.3ext \ + rd_delete.3ext \ + rd_errstr.3ext \ + rd_event_addr.3ext \ + rd_event_enable.3ext \ + rd_event_getmsg.3ext \ + rd_init.3ext \ + rd_loadobj_iter.3ext \ + rd_log.3ext \ + rd_new.3ext \ + rd_objpad_enable.3ext \ + rd_plt_resolution.3ext \ + rd_reset.3ext \ + run_crypt.3ext \ + run_setkey.3ext \ + setkey.3ext \ + tsalarm_set.3ext \ + write_vtoc.3ext + +MANFILES += $(MANSOFILES) + +_NOTE.3ext := SOSRC = man3ext/NOTE.3ext + +SUNW_C_KeyToObject.3ext := SOSRC = man3ext/SUNW_C_GetMechSession.3ext + +auto_ef_file.3ext := SOSRC = man3ext/auto_ef.3ext +auto_ef_free.3ext := SOSRC = man3ext/auto_ef.3ext +auto_ef_get_encoding.3ext := SOSRC = man3ext/auto_ef.3ext +auto_ef_get_score.3ext := SOSRC = man3ext/auto_ef.3ext +auto_ef_str.3ext := SOSRC = man3ext/auto_ef.3ext + +crypt_close.3ext := SOSRC = man3ext/crypt.3ext +des_crypt.3ext := SOSRC = man3ext/crypt.3ext +des_encrypt.3ext := SOSRC = man3ext/crypt.3ext +des_setkey.3ext := SOSRC = man3ext/crypt.3ext +encrypt.3ext := SOSRC = man3ext/crypt.3ext +run_crypt.3ext := SOSRC = man3ext/crypt.3ext +run_setkey.3ext := SOSRC = man3ext/crypt.3ext +setkey.3ext := SOSRC = man3ext/crypt.3ext + +cplus_demangle.3ext := SOSRC = man3ext/demangle.3ext + +DES_FAILED.3ext := SOSRC = man3ext/ecb_crypt.3ext +cbc_crypt.3ext := SOSRC = man3ext/ecb_crypt.3ext +des_setparity.3ext := SOSRC = man3ext/ecb_crypt.3ext + +efi_alloc_and_read.3ext := SOSRC = man3ext/efi_alloc_and_init.3ext +efi_free.3ext := SOSRC = man3ext/efi_alloc_and_init.3ext +efi_use_whole_disk.3ext := SOSRC = man3ext/efi_alloc_and_init.3ext +efi_write.3ext := SOSRC = man3ext/efi_alloc_and_init.3ext + +ld_atexit.3ext := SOSRC = man3ext/ld_support.3ext +ld_atexit64.3ext := SOSRC = man3ext/ld_support.3ext +ld_file.3ext := SOSRC = man3ext/ld_support.3ext +ld_file64.3ext := SOSRC = man3ext/ld_support.3ext +ld_input_done.3ext := SOSRC = man3ext/ld_support.3ext +ld_input_section.3ext := SOSRC = man3ext/ld_support.3ext +ld_input_section64.3ext := SOSRC = man3ext/ld_support.3ext +ld_open.3ext := SOSRC = man3ext/ld_support.3ext +ld_open64.3ext := SOSRC = man3ext/ld_support.3ext +ld_section.3ext := SOSRC = man3ext/ld_support.3ext +ld_section64.3ext := SOSRC = man3ext/ld_support.3ext +ld_start.3ext := SOSRC = man3ext/ld_support.3ext +ld_start64.3ext := SOSRC = man3ext/ld_support.3ext +ld_version.3ext := SOSRC = man3ext/ld_support.3ext + +MD4Final.3ext := SOSRC = man3ext/md4.3ext +MD4Init.3ext := SOSRC = man3ext/md4.3ext +MD4Update.3ext := SOSRC = man3ext/md4.3ext + +MD5Final.3ext := SOSRC = man3ext/md5.3ext +MD5Init.3ext := SOSRC = man3ext/md5.3ext +MD5Update.3ext := SOSRC = man3ext/md5.3ext +md5_calc.3ext := SOSRC = man3ext/md5.3ext + +write_vtoc.3ext := SOSRC = man3ext/read_vtoc.3ext + +la_activity.3ext := SOSRC = man3ext/rtld_audit.3ext +la_amd64_pltenter.3ext := SOSRC = man3ext/rtld_audit.3ext +la_i86_pltenter.3ext := SOSRC = man3ext/rtld_audit.3ext +la_objfilter.3ext := SOSRC = man3ext/rtld_audit.3ext +la_objopen.3ext := SOSRC = man3ext/rtld_audit.3ext +la_objsearch.3ext := SOSRC = man3ext/rtld_audit.3ext +la_pltexit.3ext := SOSRC = man3ext/rtld_audit.3ext +la_pltexit64.3ext := SOSRC = man3ext/rtld_audit.3ext +la_preinit.3ext := SOSRC = man3ext/rtld_audit.3ext +la_sparcv8_pltenter.3ext := SOSRC = man3ext/rtld_audit.3ext +la_sparcv9_pltenter.3ext := SOSRC = man3ext/rtld_audit.3ext +la_symbind32.3ext := SOSRC = man3ext/rtld_audit.3ext +la_symbind64.3ext := SOSRC = man3ext/rtld_audit.3ext +la_version.3ext := SOSRC = man3ext/rtld_audit.3ext + +rd_delete.3ext := SOSRC = man3ext/rtld_db.3ext +rd_errstr.3ext := SOSRC = man3ext/rtld_db.3ext +rd_event_addr.3ext := SOSRC = man3ext/rtld_db.3ext +rd_event_enable.3ext := SOSRC = man3ext/rtld_db.3ext +rd_event_getmsg.3ext := SOSRC = man3ext/rtld_db.3ext +rd_init.3ext := SOSRC = man3ext/rtld_db.3ext +rd_loadobj_iter.3ext := SOSRC = man3ext/rtld_db.3ext +rd_log.3ext := SOSRC = man3ext/rtld_db.3ext +rd_new.3ext := SOSRC = man3ext/rtld_db.3ext +rd_objpad_enable.3ext := SOSRC = man3ext/rtld_db.3ext +rd_plt_resolution.3ext := SOSRC = man3ext/rtld_db.3ext +rd_reset.3ext := SOSRC = man3ext/rtld_db.3ext + +SHA1Final.3ext := SOSRC = man3ext/sha1.3ext +SHA1Init.3ext := SOSRC = man3ext/sha1.3ext +SHA1Update.3ext := SOSRC = man3ext/sha1.3ext + +SHA256Final.3ext := SOSRC = man3ext/sha2.3ext +SHA256Init.3ext := SOSRC = man3ext/sha2.3ext +SHA256Update.3ext := SOSRC = man3ext/sha2.3ext +SHA2Final.3ext := SOSRC = man3ext/sha2.3ext +SHA2Init.3ext := SOSRC = man3ext/sha2.3ext +SHA2Update.3ext := SOSRC = man3ext/sha2.3ext +SHA384Final.3ext := SOSRC = man3ext/sha2.3ext +SHA384Init.3ext := SOSRC = man3ext/sha2.3ext +SHA384Update.3ext := SOSRC = man3ext/sha2.3ext +SHA512Final.3ext := SOSRC = man3ext/sha2.3ext +SHA512Init.3ext := SOSRC = man3ext/sha2.3ext +SHA512Update.3ext := SOSRC = man3ext/sha2.3ext + +tsalarm_set.3ext := SOSRC = man3ext/tsalarm_get.3ext + +.KEEP_STATE: + +include ../Makefile.man + +install: $(ROOTMANFILES) diff --git a/usr/src/man/man3ext/NOTE.3ext b/usr/src/man/man3ext/NOTE.3ext new file mode 100644 index 0000000000..ca60d5597f --- /dev/null +++ b/usr/src/man/man3ext/NOTE.3ext @@ -0,0 +1,174 @@ +'\" te +.\" Copyright (c) 1994 Sun Microsystems, Inc. - All Rights Reserved. +.\" 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] +.TH NOTE 3EXT "31 Dec 1996" "SunOS 5.11" "Extended Library Functions" +.SH NAME +NOTE, _NOTE \- annotate source code with info for tools +.SH SYNOPSIS +.LP +.nf +#include <note.h> + + + +\fB\fR\fBNOTE\fR(\fB\fR\fINoteInfo\fR); +.fi + +.LP +.nf +or +#include<sys/note.h> + + + +\fB\fR\fB_NOTE\fR(\fB\fR\fINoteInfo\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These macros are used to embed information for tools in program source. A use +of one of these macros is called an "annotation". A tool may define a set of +such annotations which can then be used to provide the tool with information +that would otherwise be unavailable from the source code. +.sp +.LP +Annotations should, in general, provide documentation useful to the human +reader. If information is of no use to a human trying to understand the code +but is necessary for proper operation of a tool, use another mechanism for +conveying that information to the tool (one which does not involve adding to +the source code), so as not to detract from the readability of the source. The +following is an example of an annotation which provides information of use to a +tool and to the human reader (in this case, which data are protected by a +particular lock, an annotation defined by the static lock analysis tool +\fBlock_lint\fR). +.sp +.in +2 +.nf +NOTE(MUTEX_PROTECTS_DATA(foo_lock, \fBfoo_list\fR \fBFoo))\fR +.fi +.in -2 + +.sp +.LP +Such annotations do not represent executable code; they are neither statements +nor declarations. They should not be followed by a semicolon. If a compiler or +tool that analyzes C source does not understand this annotation scheme, then +the tool will ignore the annotations. (For such tools, +\fBNOTE(\fR\fIx\fR\fB)\fR expands to nothing.) +.sp +.LP +Annotations may only be placed at particular places in the source. These +places are where the following C constructs would be allowed: +.RS +4 +.TP +.ie t \(bu +.el o +a top-level declaration (that is, a declaration not within a function or other +construct) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +a declaration or statement within a block (including the block which defines a +function) +.RE +.RS +4 +.TP +.ie t \(bu +.el o +a member of a \fBstruct\fR or \fBunion\fR. +.RE +.sp +.LP +Annotations are not allowed in any other place. For example, the following are +illegal: +.sp +.in +2 +.nf +x = y + NOTE(...) z ; +typedef NOTE(...) unsigned int uint ; +.fi +.in -2 + +.sp +.LP +While \fBNOTE\fR and \fB_NOTE\fR may be used in the places described above, a +particular type of annotation may only be allowed in a subset of those places. +For example, a particular annotation may not be allowed inside a \fBstruct\fR +or \fBunion\fR definition. +.SS "NOTE vs _NOTE" +.sp +.LP +Ordinarily, \fBNOTE\fR should be used rather than \fB_NOTE\fR, since use of +\fB_NOTE\fR technically makes a program non-portable. However, it may be +inconvenient to use \fBNOTE\fR for this purpose in existing code if \fBNOTE\fR +is already heavily used for another purpose. In this case one should use a +different macro and write a header file similar to \fB/usr/include/note.h\fR +which maps that macro to \fB_NOTE\fR in the same manner. For example, the +following makes \fBFOO\fR such a macro: +.sp +.in +2 +.nf +#ifndef _FOO_H +#define _FOO_H +#define FOO _NOTE +#include <sys/note.h> +#endif +.fi +.in -2 + +.sp +.LP +Public header files which span projects should use \fB_NOTE\fR rather than +\fBNOTE\fR, since \fBNOTE\fR may already be used by a program which needs to +include such a header file. +.SS "\fINoteInfo\fR\fB Argument\fR" +.sp +.LP +The actual \fINoteInfo\fR used in an annotation should be specified by a tool +that deals with program source (see the documentation for the tool to determine +which annotations, if any, it understands). +.sp +.LP +\fINoteInfo\fR must have one of the following forms: +.sp +.in +2 +.nf +\fINoteName +NoteName\fR(\fIArgs\fR) +.fi +.in -2 + +.sp +.LP +where \fINoteName\fR is simply an identifier which indicates the type of +annotation, and \fIArgs\fR is something defined by the tool that specifies the +particular \fINoteName.\fR The general restrictions on \fIArgs\fR are that it +be compatible with an ANSI C tokenizer and that unquoted parentheses be +balanced (so that the end of the annotation can be determined without intimate +knowledge of any particular annotation). +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBnote\fR(4), \fBattributes\fR(5) diff --git a/usr/src/man/man3ext/SUNW_C_GetMechSession.3ext b/usr/src/man/man3ext/SUNW_C_GetMechSession.3ext new file mode 100644 index 0000000000..1ea632ce67 --- /dev/null +++ b/usr/src/man/man3ext/SUNW_C_GetMechSession.3ext @@ -0,0 +1,221 @@ +'\" te +.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH SUNW_C_GetMechSession 3EXT "27 Oct 2005" "SunOS 5.11" "Extended Library Functions" +.SH NAME +SUNW_C_GetMechSession, SUNW_C_KeyToObject \- PKCS#11 Cryptographic Framework +functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lpkcs11\fR [ \fIlibrary\&.\|.\|.\fR ] +#include <security/cryptoki.h> +#include <security/pkcs11.h> + +\fBCK_RV\fR \fBSUNW_C_GetMechSession\fR(\fBCK_MECHANISM_TYPE\fR \fImech\fR, + \fBCK_SESSION_HANDLE_PTR\fR \fIhSession\fR); +.fi + +.LP +.nf +\fBCK_RV\fR \fBSUNW_C_KeyToObject\fR(\fBCK_SESSION_HANDLE\fR \fIhSession\fR, + \fBCK_MECHANISM_TYPE\fR \fImech\fR, \fBconst void *\fR\fIrawkey\fR, \fBsize_t\fR \fIrawkey_len\fR, + \fBCK_OBJECT_HANDLE_PTR\fR \fIobj\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These functions implement the RSA PKCS#11 v2.20 specification by using plug-ins +to provide the slots. +.sp +.LP +The \fBSUNW_C_GetMechSession()\fR function initializes the PKCS#11 +cryptographic framework and performs all necessary calls to Standard PKCS#11 +functions (see \fBlibpkcs11\fR(3LIB)) to create a session capable of providing +operations on the requested mechanism. It is not neccessary to call +\fBC_Initalize()\fR or \fBC_GetSlotList()\fR before the first call to +\fBSUNW_C_GetMechSession()\fR. +.sp +.LP +If the \fBSUNW_C_GetMechSession()\fR function is called multiple times, it will +return a new session each time without re-initalizing the framework. If it is +unable to return a new session, \fBCKR_SESSION_COUNT\fR is returned. +.sp +.LP +The \fBC_CloseSession()\fR function should be called to release the session +when it is no longer required. +.sp +.LP +The \fBSUNW_C_KeyToObject()\fR function creates a key object for the specified +mechanism from the \fIrawkey\fR data. The object should be destroyed with +\fBC_DestroyObject()\fR when it is no longer required. +.SH RETURN VALUES +.sp +.LP +The \fBSUNW_C_GetMechSession()\fR function returns the following values: +.sp +.ne 2 +.mk +.na +\fB\fBCKR_OK\fR\fR +.ad +.RS 25n +.rt +The function completed successfully. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_SESSION_COUNT\fR\fR +.ad +.RS 25n +.rt +No sessions are available. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_ARGUMENTS_BAD\fR\fR +.ad +.RS 25n +.rt +A null pointer was passed for the return session handle. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_MECHANISM_INVALID\fR\fR +.ad +.RS 25n +.rt +The requested mechanism is invalid or no available plug-in provider supports +it. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_FUNCTION_FAILED\fR\fR +.ad +.RS 25n +.rt +The function failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_GENERAL_ERROR\fR\fR +.ad +.RS 25n +.rt +A general error occurred. +.RE + +.sp +.LP +The \fBSUNW_C_KeyToObject()\fR function returns the following values: +.sp +.ne 2 +.mk +.na +\fB\fBCKR_OK\fR\fR +.ad +.RS 25n +.rt +The function completed successfully. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_ARGUMENTS_BAD\fR\fR +.ad +.RS 25n +.rt +A null pointer was passed for the session handle or the key material. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_MECHANISM_INVALID\fR\fR +.ad +.RS 25n +.rt +The requested mechanism is invalid or no available plug-in provider supports +it. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_FUNCTION_FAILED\fR\fR +.ad +.RS 25n +.rt +The function failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBCKR_GENERAL_ERROR\fR\fR +.ad +.RS 25n +.rt +A general error occurred. +.RE + +.sp +.LP +The return values of each of the implemented functions are defined and listed +in the RSA PKCS#11 v2.20 specification. See http://www.rsasecurity.com. +.SH USAGE +.sp +.LP +These functions are not part of the RSA PKCS#11 v2.20 specification. They are +not likely to exist on non-Solaris systems. They are provided as a convenience +to application programmers. Use of these functions will make the application +non-portable to other systems. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityEvolving +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibpkcs11\fR(3LIB), \fBattributes\fR(5) +.sp +.LP +http://www.rsasecurity.com diff --git a/usr/src/man/man3ext/auto_ef.3ext b/usr/src/man/man3ext/auto_ef.3ext new file mode 100644 index 0000000000..2fb1f7b4b1 --- /dev/null +++ b/usr/src/man/man3ext/auto_ef.3ext @@ -0,0 +1,213 @@ +'\" te +.\" Copyright (c) 1983 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved +.TH auto_ef 3EXT "22 Sep 2003" "SunOS 5.11" "Extended Library Functions" +.SH NAME +auto_ef, auto_ef_file, auto_ef_str, auto_ef_free, auto_ef_get_encoding, +auto_ef_get_score \- auto encoding finder functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag \fR... ] \fIfile\fR... \fB-lauto_ef\fR [ \fIlibrary\fR... ] +#include <auto_ef.h> + +\fBsize_t\fR \fBauto_ef_file\fR(\fBauto_ef_t **\fR\fIinfo\fR, \fBconst char *\fR\fIfilename\fR, \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBsize_t\fR \fBauto_ef_str\fR(\fBauto_ef_t **\fR\fIinfo\fR, \fBconst char *\fR\fIbuffer\fR, \fBsize_t\fR \fIbufsize\fR, + \fBint\fR \fIflags\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBauto_ef_free\fR(\fBauto_ef_t *\fR\fIinfo\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBauto_ef_get_encoding\fR(\fBauto_ef_t\fR \fIinfo\fR); +.fi + +.LP +.nf +\fBdouble\fR \fBauto_ef_get_score\fR(\fBauto_ef_t\fR \fIinfo\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +Auto encoding finder provides functions that find the encoding of given file or +string. +.sp +.LP +The \fBauto_ef_file()\fR function examines text in the file specified with +\fIfilename\fR and returns information on possible encodings. +.sp +.LP +The \fIinfo\fR argument is a pointer to a pointer to an \fBauto_ef_t\fR, the +location at which the pointer to the \fBauto_ef_t\fR array is stored upon +return. +.sp +.LP +The \fIflags\fR argument specifies the level of examination. Currently only one +set of flags, exclusive each other, is available: \fBAE_LEVEL_0\fR, +\fBAE_LEVEL_1\fR, \fBAE_LEVEL_2\fR, and \fBAE_LEVEL_3\fR. The \fBAE_LEVEL_0\fR +level is fastest but the result can be less accurate. The \fBAE_LEVEL_3\fR +level produces best result but can be slow. If the \fIflags\fR argument is +unspecified, the default is \fBAE_LEVEL_0\fR. When another flag or set of flags +are defined in the future, use the inclusive-bitwise OR operation to specify +multiple flags. +.sp +.LP +Information about encodings are stored in data type\fBauto_ef_t\fR in the order +of possibility with the most possible encoding stored first. To examine the +information, use the \fBauto_ef_get_encoding()\fR and \fBauto_ef_get_score()\fR +access functions. For a list of encodings with which \fBauto_ef_file()\fR can +examine text, see \fBauto_ef\fR(1). +.sp +.LP +If \fBauto_ef_file()\fR cannot determine the encoding of text, it returns 0 and +stores \fINULL\fR at the location pointed by \fIinfo\fR. +.sp +.LP +The \fBauto_ef_get_encoding()\fR function returns the name of the encoding. The +returned string is vaild until until the location pointed to by \fIinfo\fR is +freed with \fBauto_ef_free()\fR. Applications should not use \fBfree\fR(3C) to +free the pointer returned by \fBauto_ef_get_encoding()\fR. +.sp +.LP +The \fBauto_ef_get_score()\fR function returns the score of this encoding in +the range between 0.0 and 1.0. +.sp +.LP +The \fBauto_ef_str()\fR function is identical to \fBauto_ef_file()\fR, except +that it examines text in the buffer specified by \fIbuffer\fR with a maximum +size of \fIbufsize\fR bytes, instead of text in a file. +.sp +.LP +The \fBauto_ef_free()\fR function frees the area allocated by +\fBauto_ef_file()\fR or by \fBauto_ef_str()\fR, taking as its argument the +pointer stored at the location pointed to by \fIinfo\fR. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, the \fBauto_ef_file()\fR and \fBauto_ef_str()\fR +functions return the number of possible encodings for which information is +stored. Otherwise, \(mi1 is returned. +.sp +.LP +The \fBauto_ef_get_encoding()\fR function returns the string that stores the +encoding name. +.sp +.LP +the \fBauto_ef_get_score()\fR function returns the score value for encoding the +name with the examined text data. +.SH ERRORS +.sp +.LP +The \fBauto_ef_file()\fR and \fBauto_ef_str()\fR will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBEACCES\fR\fR +.ad +.RS 10n +.rt +Search permission is denied on a component of the path prefix, the file exists +and the permissions specified by mode are denied, the file does not exist and +write permission is denied for the parent directory of the file to be created, +or \fBlibauto_ef\fR cannot find the internal hashtable. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEINTR\fR\fR +.ad +.RS 10n +.rt +A signal was caught during the execution. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBENOMEM\fR\fR +.ad +.RS 10n +.rt +Failed to allocate area to store the result. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEMFILE\fR\fR +.ad +.RS 10n +.rt +Too many files descriptors are currently open in the calling process. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBENFILE\fR\fR +.ad +.RS 10n +.rt +Too many files are currently open in the system. +.RE + +.SH EXAMPLES +.LP +\fBExample 1 \fRSpecify the array index to examine stored information. +.sp +.LP +Since \fBauto_ef_file()\fR stores the array whose elements hold information on +each possible encoding, the following example specifies the array index to +examine the stored information. + +.sp +.in +2 +.nf +#include <auto_ef.h> +auto_ef_t *array_info; +size_t number; +char *encoding; + +number = auto_ef_file(&array_info, filename, flags); +encoding = auto_ef_get_encoding(array_info[0]); +auto_ef_free(array_info); +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityStable +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBauto_ef\fR(1), \fBlibauto_ef\fR(3LIB), \fBattributes\fR(5) diff --git a/usr/src/man/man3ext/crypt.3ext b/usr/src/man/man3ext/crypt.3ext new file mode 100644 index 0000000000..c6dc47ffba --- /dev/null +++ b/usr/src/man/man3ext/crypt.3ext @@ -0,0 +1,163 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright 1989 AT&T +.\" 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] +.TH crypt 3EXT "3 Mar 2008" "SunOS 5.11" "Extended Library Functions" +.SH NAME +crypt, setkey, encrypt, des_crypt, des_setkey, des_encrypt, run_setkey, +run_crypt, crypt_close \- password and file encryption functions +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lcrypt\fR [ \fIlibrary\fR ... ] +#include <crypt.h> + +\fBchar *\fR\fBcrypt\fR(\fBconst char *\fR\fIkey\fR, \fBconst char *\fR\fIsalt\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBsetkey\fR(\fBconst char *\fR\fIkey\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBencrypt\fR(\fBchar *\fR\fIblock\fR, \fBint\fR \fIflag\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBdes_crypt\fR(\fBconst char *\fR\fIkey\fR, \fBconst char *\fR\fIsalt\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBdes_setkey\fR(\fBconst char *\fR\fIkey\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBdes_encrypt\fR(\fBchar *\fR\fIblock\fR, \fBint\fR \fIflag\fR); +.fi + +.LP +.nf +\fBint\fR \fBrun_setkey\fR(\fBint *\fR\fIp\fR, \fBconst char *\fR\fIkey\fR); +.fi + +.LP +.nf +\fBint\fR \fBrun_crypt\fR(\fBlong\fR \fIoffset\fR, \fBchar *\fR\fIbuffer\fR, \fBunsigned int\fR \fIcount\fR, + \fBint *\fR\fIp\fR); +.fi + +.LP +.nf +\fBint\fR \fBcrypt_close\fR(\fBint *\fR\fIp\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +\fBdes_crypt()\fR is the password encryption function. It is based on a one-way +hashing encryption algorithm with variations intended (among other things) to +frustrate use of hardware implementations of a key search. +.sp +.LP +\fIkey\fR is a user's typed password. \fIsalt\fR is a two-character string +chosen from the set [\fBa-zA-Z0-9./\fR]; this string is used to perturb the +hashing algorithm in one of 4096 different ways, after which the password is +used as the key to encrypt repeatedly a constant string. The returned value +points to the encrypted password. The first two characters are the salt itself. +.sp +.LP +The \fBdes_setkey()\fR and \fBdes_encrypt()\fR entries provide (rather +primitive) access to the actual hashing algorithm. The argument of +\fBdes_setkey()\fR is a character array of length 64 containing only the +characters with numerical value 0 and 1. If this string is divided into groups +of 8, the low-order bit in each group is ignored, thereby creating a 56-bit key +that is set into the machine. This key is the key that will be used with the +hashing algorithm to encrypt the string \fIblock\fR with the function +\fBdes_encrypt()\fR. +.sp +.LP +The argument to the \fBdes_encrypt()\fR entry is a character array of length 64 +containing only the characters with numerical value 0 and 1. The argument array +is modified in place to a similar array representing the bits of the argument +after having been subjected to the hashing algorithm using the key set by +\fBdes_setkey()\fR. If \fIflag\fR is zero, the argument is encrypted; if +non-zero, it is decrypted. +.sp +.LP +Note that decryption is not provided in the international version of +\fBcrypt()\fR. The international version is part of the C Development Set, and +the domestic version is part of the Security Administration Utilities. If +decryption is attempted with the international version of \fBdes_encrypt()\fR, +an error message is printed. +.sp +.LP +\fBcrypt()\fR, \fBsetkey()\fR, and \fBencrypt()\fR are front-end routines that +invoke \fBdes_crypt()\fR, \fBdes_setkey()\fR, and \fBdes_encrypt()\fR +respectively. +.sp +.LP +The routines \fBrun_setkey()\fR and \fBrun_crypt()\fR are designed for use by +applications that need cryptographic capabilities, such as \fBed\fR(1) and +\fBvi\fR(1). \fBrun_setkey()\fR establishes a two-way pipe connection with the +\fBcrypt\fR utility, using \fIkey\fR as the password argument. +\fBrun_crypt()\fR takes a block of characters and transforms the cleartext or +ciphertext into their ciphertext or cleartext using the \fBcrypt\fR utility. +\fIoffset\fR is the relative byte position from the beginning of the file that +the block of text provided in \fIblock\fR is coming from. \fIcount\fR is the +number of characters in \fIblock\fR, and \fIconnection\fR is an array +containing indices to a table of input and output file streams. When +encryption is finished, \fBcrypt_close()\fR is used to terminate the connection +with the \fBcrypt\fR utility. +.sp +.LP +\fBrun_setkey()\fR returns \fB\(mi1\fR if a connection with the \fBcrypt\fR +utility cannot be established. This result will occur in international versions +of the UNIX system in which the \fBcrypt\fR utility is not available. If a +null key is passed to \fBrun_setkey()\fR, \fB0\fR is returned. Otherwise, +\fB1\fR is returned. \fBrun_crypt()\fR returns \fB\(mi1\fR if it cannot write +output or read input from the pipe attached to \fBcrypt()\fR. Otherwise it +returns \fB0\fR. +.sp +.LP +The program must be linked with the object file access routine library +\fBlibcrypt.a\fR. +.SH RETURN VALUES +.sp +.LP +In the international version of \fBcrypt()\fR, a flag argument of \fB1\fR to +\fBencrypt()\fR or \fBdes_encrypt()\fR is not accepted, and \fBerrno\fR is set +to \fBENOSYS\fR to indicate that the functionality is not available. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +MT-LevelUnsafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBed\fR(1), \fBlogin\fR(1), \fBpasswd\fR(1), \fBvi\fR(1), \fBgetpass\fR(3C), +\fBpasswd\fR(4), \fBattributes\fR(5) +.SH NOTES +.sp +.LP +The return value in \fBcrypt()\fR points to static data that are overwritten by +each call. diff --git a/usr/src/man/man3ext/demangle.3ext b/usr/src/man/man3ext/demangle.3ext new file mode 100644 index 0000000000..2fa1e3ecf2 --- /dev/null +++ b/usr/src/man/man3ext/demangle.3ext @@ -0,0 +1,86 @@ +'\" te +.\" Copyright (c) 1997 Sun Microsystems, Inc All Rights Reserved +.\" 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] +.TH demangle 3EXT "11 Mar 1997" "SunOS 5.11" "Extended Library Functions" +.SH NAME +demangle, cplus_demangle \- decode a C++ encoded symbol name +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR[ \fIlibrary\fR ... ] \fB-ldemangle\fR + +#include <demangle.h> + + + +\fBint\fR \fBcplus_demangle\fR(\fBconst char *\fR\fIsymbol\fR, \fBchar *\fR\fIprototype\fR, \fBsize_t\fR \fIsize\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBcplus_demangle()\fR function decodes (demangles) a C++ linker symbol +name (mangled name) into a (partial) C++ prototype, if possible. C++ mangled +names may not have enough information to form a complete prototype. +.sp +.LP +The \fIsymbol\fR string argument points to the input mangled name. +.sp +.LP +The \fIprototype\fR argument points to a user-specified output string buffer, +of \fBsize\fR bytes. +.sp +.LP +The \fBcplus_demangle()\fR function operates on mangled names generated by +SPARCompilers C++ 3.0.1, 4.0.1, 4.1 and 4.2. +.sp +.LP +The \fBcplus_demangle()\fR function improves and replaces the \fBdemangle()\fR +function. +.sp +.LP +Refer to the \fBCC.1\fR, \fBdem.1\fR, and \fBc++filt.1\fR manual pages in the +\fB/opt/SUNWspro/man/man1\fR directory. These pages are only available with +the SPROcc package. +.SH RETURN VALUES +.sp +.LP +The \fBcplus_demangle()\fR function returns the following values: +.sp +.ne 2 +.mk +.na +\fB\fB0\fR\fR +.ad +.RS 19n +.rt +The \fIsymbol\fR argument is a valid mangled name and \fIprototype\fR contains +a (partial) prototype for the symbol. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBDEMANGLE_ENAME\fR\fR +.ad +.RS 19n +.rt +The \fIsymbol\fR argument is not a valid mangled name and the content of +\fIprototype\fR is a copy of the symbol. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBDEMANGLE_ESPACE\fR\fR +.ad +.RS 19n +.rt +The \fIprototype\fR output buffer is too small to contain the prototype (or the +symbol), and the content of \fIprototype\fR is undefined. +.RE + diff --git a/usr/src/man/man3ext/ecb_crypt.3ext b/usr/src/man/man3ext/ecb_crypt.3ext new file mode 100644 index 0000000000..999ea1916a --- /dev/null +++ b/usr/src/man/man3ext/ecb_crypt.3ext @@ -0,0 +1,138 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH ecb_crypt 3EXT "3 Mar 2008" "SunOS 5.11" "Extended Library Functions" +.SH NAME +ecb_crypt, cbc_crypt, des_setparity, DES_FAILED \- fast DES encryption +.SH SYNOPSIS +.LP +.nf +#include <rpc/des_crypt.h> + +\fBint\fR \fBecb_crypt\fR(\fBchar *\fR\fIkey\fR, \fBchar *\fR\fIdata\fR, \fBunsigned\fR \fIdatalen\fR, + \fBunsigned\fR \fImode\fR); +.fi + +.LP +.nf +\fBint\fR \fBcbc_crypt\fR(\fBchar *\fR\fIkey\fR, \fBchar *\fR\fIdata\fR, \fBunsigned\fR \fIdatalen\fR, + \fBunsigned\fR \fImode\fR, \fBchar *\fR\fIivec\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBdes_setparity\fR(\fBchar *\fR\fIkey\fR); +.fi + +.LP +.nf +\fBint\fR \fBDES_FAILED\fR(\fBint\fR \fIstat\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +\fBecb_crypt()\fR and \fBcbc_crypt()\fR implement the \fBNBS\fR \fBDES\fR (Data +Encryption Standard). These routines are faster and more general purpose than +\fBcrypt\fR(3C). They also are able to utilize \fBDES\fR hardware if it is +available. \fBecb_crypt()\fR encrypts in \fBECB\fR (Electronic Code Book) mode, +which encrypts blocks of data independently. \fBcbc_crypt()\fR encrypts in +\fBCBC\fR (Cipher Block Chaining) mode, which chains together successive +blocks. \fBCBC\fR mode protects against insertions, deletions, and +substitutions of blocks. Also, regularities in the clear text will not appear +in the cipher text. +.sp +.LP +The first parameter, \fIkey\fR, is the 8-byte encryption key with parity. To +set the key's parity, which for \fBDES\fR is in the low bit of each byte, use +\fBdes_setparity()\fR. The second parameter, \fIdata\fR, contains the data to +be encrypted or decrypted. The third parameter, \fIdatalen\fR, is the length in +bytes of \fIdata\fR, which must be a multiple of 8. The fourth parameter, +\fImode\fR, is formed by \fBOR'ing\fR together the \fBDES_ENCRYPT\fR or +\fBDES_DECRYPT\fR to specify the encryption direction and \fBDES_HW\fR or +\fBDES_SW\fR to specify software or hardware encryption. If \fBDES_HW\fR is +specified, and there is no hardware, then the encryption is performed in +software and the routine returns \fBDESERR_NOHWDEVICE.\fR +.sp +.LP +For \fBcbc_crypt()\fR, the parameter \fIivec\fR is the 8-byte initialization +vector for the chaining. It is updated to the next initialization vector upon +successful return. +.SH RETURN VALUES +.sp +.LP +Given a result status \fIstat\fR, the macro \fBDES_FAILED\fR is false only for +the first two statuses. +.sp +.ne 2 +.mk +.na +\fB\fBDESERR_NONE\fR\fR +.ad +.RS 21n +.rt +No error. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBDESERR_NOHWDEVICE\fR\fR +.ad +.RS 21n +.rt +Encryption succeeded, but done in software instead of the requested hardware. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBDESERR_HWERROR\fR\fR +.ad +.RS 21n +.rt +An error occurred in the hardware or driver. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBDESERR_BADPARAM\fR\fR +.ad +.RS 21n +.rt +Bad parameter to routine. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBcrypt\fR(3C), \fBattributes\fR(5) +.SH NOTES +.sp +.LP +When compiling multi-thread applications, the \fB_REENTRANT\fR flag must be +defined on the compile line. This flag should only be used in multi-thread +applications. diff --git a/usr/src/man/man3ext/efi_alloc_and_init.3ext b/usr/src/man/man3ext/efi_alloc_and_init.3ext new file mode 100644 index 0000000000..394569cbe4 --- /dev/null +++ b/usr/src/man/man3ext/efi_alloc_and_init.3ext @@ -0,0 +1,249 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH efi_alloc_and_init 3EXT "8 May 2008" "SunOS 5.11" "Extended Library Functions" +.SH NAME +efi_alloc_and_init, efi_alloc_and_read, efi_free, efi_write, efi_use_whole_disk +\- manipulate a disk's EFI Partition Table +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lefi\fR [ \fIlibrary \&.\|.\|.\fR ] +#include <sys/vtoc.h> +#include <sys/efi_partition.h> + +\fBint\fR \fBefi_alloc_and_init\fR(\fBint\fR \fIfd\fR, \fBuint32_t\fR \fInparts\fR, \fBdk_gpt_t **\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBefi_alloc_and_read\fR(\fBint\fR \fIfd\fR, \fBdk_gpt_t **\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBefi_free\fR(\fBdk_gpt_t *\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBefi_write\fR(\fBint\fR \fIfd\fR, \fBdk_gpt_t *\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBefi_use_whole_disk\fR(\fBint\fR \fIfd\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBefi_alloc_and_init()\fR function initializes the \fBdk_gpt_t\fR +structure specified by \fIvtoc\fR in preparation for a call to +\fBefi_write()\fR. It calculates and initializes the \fBefi_version\fR, +\fBefi_lbasize\fR, \fBefi_nparts\fR, \fBefi_first_u_lba\fR, \fBefi_last_lba\fR, +and \fBefi_last_u_lba\fR members of this sturcture. The caller can then set the +\fBefi_nparts\fR member. +.sp +.LP +The \fBefi_alloc_and_read()\fR function allocates memory and returns the +partition table. +.sp +.LP +The \fBefi_free()\fR function frees the memory allocated by +\fBefi_alloc_and_init()\fR and \fBefi_alloc_and_read()\fR. +.sp +.LP +The \fBefi_write()\fR function writes the EFI partition table. +.sp +.LP +The \fBefi_use_whole_disk()\fR function takes any space that is not contained +in the disk label and adds it to the last physically non-zero area before the +reserved slice (from slice 0 to slice 6 or unallocated space). +.sp +.LP +The \fIfd\fR argument refers to any slice on a raw disk, opened with +\fBO_NDELAY\fR. See \fBopen\fR(2). +.sp +.LP +The \fInparts\fR argument specifies the number of desired partitions. +.sp +.LP +The \fIvtoc\fR argument is a \fBdk_gpt_t\fR structure that describes an EFI +partition table and contains at least the following members: +.sp +.in +2 +.nf +uint_t efi_version; /* set to EFI_VERSION_CURRENT */ +uint_t efi_nparts; /* number of partitions in efi_parts */ +uint_t efi_lbasize; /* size of block in bytes */ +diskaddr_t efi_last_lba; /* last block on the disk */ +diskaddr_t efi_first_u_lba; /* first block after labels */ +diskaddr_t efi_last_u_lba; /* last block before backup labels */ +struct dk_part efi_parts[]; /* array of partitions */ +.fi +.in -2 + +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBefi_alloc_and_init()\fR returns 0. Otherwise it +returns \fBVT_EIO\fR if an I/O operation to the disk fails. +.sp +.LP +Upon successful completion, \fBefi_alloc_and_read()\fR returns a positive +integer indicating the slice index associated with the open file descriptor. +Otherwise, it returns a negative integer to indicate one of the following: +.sp +.ne 2 +.mk +.na +\fB\fBVT_EIO\fR\fR +.ad +.RS 13n +.rt +An I/O error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ERROR\fR\fR +.ad +.RS 13n +.rt +An unknown error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_EINVAL\fR\fR +.ad +.RS 13n +.rt +An EFI label was not found. +.RE + +.sp +.LP +Upon successful completion, \fBefi_write()\fR returns 0. Otherwise, it returns +a negative integer to indicate one of the following: +.sp +.ne 2 +.mk +.na +\fB\fBVT_EIO\fR\fR +.ad +.RS 13n +.rt +An I/O error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ERROR\fR\fR +.ad +.RS 13n +.rt +An unknown error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_EINVAL\fR\fR +.ad +.RS 13n +.rt +The label contains incorrect data. +.RE + +.sp +.LP +Upon successfully completion, \fBefi_use_whole_disk()\fR returns 0. Otherwise, +it returns a negative integer to indicate one of the following: +.sp +.ne 2 +.mk +.na +\fB\fBVT_EIO\fR\fR +.ad +.RS 13n +.rt +An I/O error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ERROR\fR\fR +.ad +.RS 13n +.rt +An unknown error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_EINVAL\fR\fR +.ad +.RS 13n +.rt +The label contains incorrect data. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ENOSPC\fR\fR +.ad +.RS 13n +.rt +Space out of label was not found. +.RE + +.SH USAGE +.sp +.LP +The EFI label is used on disks with more than 1^32-1 blocks. For compatibility +reasons, the \fBread_vtoc\fR(3EXT) and \fBwrite_vtoc()\fR functions should be +used on smaller disks. The application should attempt the \fBread_vtoc()\fR or +\fBwrite_vtoc()\fR call, check for an error of \fBVT_ENOTSUP\fR, then call the +analogous EFI function. +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelUnsafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBfmthard\fR(1M), \fBformat\fR(1M), \fBprtvtoc\fR(1M), \fBioctl\fR(2), +\fBopen\fR(2), \fBlibefi\fR(3LIB), \fBread_vtoc\fR(3EXT), \fBattributes\fR(5), +\fBdkio\fR(7I) diff --git a/usr/src/man/man3ext/ld_support.3ext b/usr/src/man/man3ext/ld_support.3ext new file mode 100644 index 0000000000..a6257ee1f2 --- /dev/null +++ b/usr/src/man/man3ext/ld_support.3ext @@ -0,0 +1,106 @@ +'\" te +.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH ld_support 3ext "3 Nov 2006" "SunOS 5.11" "Extended Library Functions" +.SH NAME +ld_support, ld_atexit, ld_atexit64, ld_file, ld_file64, ld_input_done, +ld_input_section, ld_input_section64, ld_open, ld_open64, ld_section, +ld_section64, ld_start, ld_start64, ld_version \- link-editor support functions +.SH SYNOPSIS +.LP +.nf +\fBvoid\fR \fBld_atexit\fR(\fBint\fR \fIstatus\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_atexit64\fR(\fBint\fR \fIstatus\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_file\fR(\fBconst char *\fR\fIname\fR, \fBconst Elf_Kind\fR \fIkind\fR, \fBint\fR \fIflags\fR, + \fBElf *\fR\fIelf\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_file64\fR(\fBconst char *\fR\fIname\fR, \fBconst Elf_Kind\fR \fIkind\fR, \fBint\fR \fIflags\fR, + \fBElf *\fR\fIelf\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_input_done\fR(\fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_input_section\fR(\fBconst char *\fR\fIname\fR, \fBElf32_Shdr **\fR\fIshdr\fR, + \fBElf32_Word\fR \fIsndx\fR, \fBElf_Data *\fR\fIdata\fR, \fBElf *\fR\fIelf\fR, \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_input_section64\fR(\fBconst char *\fR\fIname\fR, \fBElf64_Shdr **\fR\fIshdr\fR, + \fBElf64_Word\fR \fIsndx\fR, \fBElf_Data *\fR\fIdata\fR, \fBElf *\fR\fIelf\fR, \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_open\fR(\fBconst char **\fR\fIpname\fR, \fBconst char **\fR\fIfname\fR, \fBint *\fR\fIfd\fR, + \fBint\fR \fIflags\fR, \fBElf **\fR\fIelf\fR, \fBElf *\fR\fIref\fR, \fBsize_t\fR \fIoff\fR, \fBElf_kind\fR \fIkind\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_open64\fR(\fBconst char **\fR\fIpname\fR, \fBconst char **\fR\fIfname\fR, \fBint *\fR\fIfd\fR, + \fBint\fR \fIflags\fR, \fBElf **\fR\fIelf\fR, \fBElf *\fR\fIref\fR, \fBsize_t\fR \fIoff\fR, \fBElf_kind\fR \fIkind\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_section\fR(\fBconst char *\fR\fIname\fR, \fBElf32_Shdr\fR \fIshdr\fR, \fBElf32_Word\fR \fIsndx\fR, + \fBElf_Data *\fR\fIdata\fR, \fBElf *\fR\fIelf\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_section64\fR(\fBconst char *\fR\fIname\fR, \fBElf64_Shdr\fR \fIshdr\fR, \fBElf64_Word\fR \fIsndx\fR, + \fBElf_Data *\fR\fIdata\fR, \fBElf *\fR\fIelf\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_start\fR(\fBconst char *\fR\fIname\fR, \fBconst Elf32_Half\fR \fItype\fR, + \fBconst char *\fR\fIcaller\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_start64\fR(\fBconst char *\fR\fIname\fR, \fBconst Elf64_Half\fR \fItype\fR, + \fBconst char *\fR\fIcaller\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBld_version\fR(\fBuint_t\fR \fIversion\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +A link-editor support library is a user-created shared object offering one or +more of these interfaces. These interfaces are called by the link-editor +\fBld\fR(1) at various stages of the link-editing process. See the \fILinker +and Libraries Guide\fR for a full description of the link-editor support +mechanism. +.SH SEE ALSO +.sp +.LP +\fBld\fR(1) +.sp +.LP +\fILinker and Libraries Guide\fR diff --git a/usr/src/man/man3ext/md4.3ext b/usr/src/man/man3ext/md4.3ext new file mode 100644 index 0000000000..7ed13390b7 --- /dev/null +++ b/usr/src/man/man3ext/md4.3ext @@ -0,0 +1,138 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH md4 3EXT "13 Nov 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +md4, MD4Init, MD4Update, MD4Final \- MD4 digest functions +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd\fR [ \fIlibrary\fR ... ] +#include <md4.h> + +\fBvoid\fR \fBMD4Init\fR(\fBMD4_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBMD4Update\fR(\fBMD4_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBMD4Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBMD4_CTX *\fR\fIcontext\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBMD4\fR functions implement the \fBMD4\fR message-digest algorithm. The +algorithm takes as input a message of arbitrary length and produces a +"fingerprint" or "message digest" as output. The \fBMD4\fR message-digest +algorithm is intended for digital signature applications in which large files +are "compressed" in a secure manner before being encrypted with a private +(secret) key under a public-key cryptosystem such as RSA. +.SS "\fBMD4Init()\fR, \fBMD4Update()\fR, \fBMD4Final()\fR" +.sp +.LP +The \fBMD4Init()\fR, \fBMD4Update()\fR, and \fBMD4Final()\fR functions allow an +\fBMD4\fR digest to be computed over multiple message blocks. Between blocks, +the state of the \fBMD4\fR computation is held in an \fBMD4\fR context +structure allocated by the caller. A complete digest computation consists of +calls to \fBMD4\fR functions in the following order: one call to +\fBMD4Init()\fR, one or more calls to \fBMD4Update()\fR, and one call to +\fBMD4Final()\fR. +.sp +.LP +The \fBMD4Init()\fR function initializes the \fBMD4\fR context structure +pointed to by \fIcontext\fR. +.sp +.LP +The \fBMD4Update()\fR function computes a partial \fBMD4\fR digest on the +\fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the +\fBMD4\fR context structure pointed to by \fIcontext\fR accordingly. +.sp +.LP +The \fBMD4Final()\fR function generates the final \fBMD4\fR digest, using the +\fBMD4\fR context structure pointed to by \fIcontext\fR. The \fBMD4\fR digest +is written to output. After a call to \fBMD4Final()\fR, the state of the +context structure is undefined. It must be reinitialized with \fBMD4Init()\fR +before it can be used again. +.SH RETURN VALUES +.sp +.LP +These functions do not return a value. +.SH SECURITY +.sp +.LP +The \fBMD4\fR digest algorithm is not currently considered cryptographically +secure. It is included in \fBlibmd\fR(3LIB) for use by legacy protocols and +systems only. It should not be used by new systems or protocols. +.SH EXAMPLES +.LP +\fBExample 1 \fRAuthenticate a message found in multiple buffers +.sp +.LP +The following is a sample function that must authenticate a message that is +found in multiple buffers. The calling function provides an authentication +buffer that will contain the result of the \fBMD4\fR digest. + +.sp +.in +2 +.nf +#include <sys/types.h> +#include <sys/uio.h> +#include <md4.h> + +int +AuthenticateMsg(unsigned char *auth_buffer, struct iovec + *messageIov, unsigned int num_buffers) +{ + MD4_CTX ctx; + unsigned int i; + + MD4Init(&ctx); + + for(i=0; i<num_buffers; i++) + { + MD4Update(&ctx, messageIov->iov_base, + messageIov->iov_len); + messageIov += sizeof(struct iovec); + } + + MD4Final(auth_buffer, &ctx); + + return 0; +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibmd\fR(3LIB) +.sp +.LP +RFC 1320 diff --git a/usr/src/man/man3ext/md5.3ext b/usr/src/man/man3ext/md5.3ext new file mode 100644 index 0000000000..ced2c8cbf9 --- /dev/null +++ b/usr/src/man/man3ext/md5.3ext @@ -0,0 +1,163 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved +.\" 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] +.TH md5 3EXT "13 Nov 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +md5, md5_calc, MD5Init, MD5Update, MD5Final \- MD5 digest functions +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd5\fR [ \fIlibrary\fR ... ] +#include <md5.h> + +\fBvoid\fR \fBmd5_calc\fR(\fBunsigned char *\fR\fIoutput\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBMD5Init\fR(\fBMD5_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBMD5Update\fR(\fBMD5_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBMD5Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBMD5_CTX *\fR\fIcontext\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +These functions implement the MD5 message-digest algorithm, which takes as +input a message of arbitrary length and produces as output a 128-bit +"fingerprint" or "message digest" of the input. It is intended for digital +signature applications, where large file must be "compressed" in a secure +manner before being encrypted with a private (secret) key under a public-key +cryptosystem such as RSA. +.SS "\fBmd5_calc()\fR" +.sp +.LP +The \fBmd5_calc()\fR function computes an MD5 digest on a single message block. +The \fIinlen\fR-byte block is pointed to by \fIinput\fR, and the 16-byte MD5 +digest is written to \fIoutput\fR. +.SS "\fBMD5Init()\fR, \fBMD5Update()\fR, \fBMD5Final()\fR" +.sp +.LP +The \fBMD5Init()\fR, \fBMD5Update()\fR, and \fBMD5Final()\fR functions allow an +MD5 digest to be computed over multiple message blocks; between blocks, the +state of the MD5 computation is held in an MD5 context structure, allocated by +the caller. A complete digest computation consists of one call to +\fBMD5Init()\fR, one or more calls to \fBMD5Update()\fR, and one call to +\fBMD5Final()\fR, in that order. +.sp +.LP +The \fBMD5Init()\fR function initializes the MD5 context structure pointed to +by \fIcontext\fR. +.sp +.LP +The \fBMD5Update()\fR function computes a partial MD5 digest on the +\fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the MD5 +context structure pointed to by \fIcontext\fR accordingly. +.sp +.LP +The \fBMD5Final()\fR function generates the final MD5 digest, using the MD5 +context structure pointed to by \fIcontext\fR; the 16-byte MD5 digest is +written to \fIoutput\fR. After calling \fBMD5Final()\fR, the state of the +context structure is undefined; it must be reinitialized with \fBMD5Init()\fR +before being used again. +.SH RETURN VALUES +.sp +.LP +These functions do not return a value. +.SH EXAMPLES +.LP +\fBExample 1 \fRAuthenticate a message found in multiple buffers +.sp +.LP +The following is a sample function that must authenticate a message that is +found in multiple buffers. The calling function provides an authentication +buffer that will contain the result of the MD5 digest. + +.sp +.in +2 +.nf +#include <sys/types.h> +#include <sys/uio.h> +#include <md5.h> + +int +AuthenticateMsg(unsigned char *auth_buffer, struct iovec + *messageIov, unsigned int num_buffers) +{ + MD5_CTX md5_context; + unsigned int i; + + MD5Init(&md5_context); + + for(i=0; i<num_buffers; i++) + { + MD5Update(&md5_context, messageIov->iov_base, + messageIov->iov_len); + messageIov += sizeof(struct iovec); + } + + MD5Final(auth_buffer, &md5_context); + + return 0; +} +.fi +.in -2 + +.LP +\fBExample 2 \fRUse \fBmd5_calc()\fR to generate the MD5 digest +.sp +.LP +Since the buffer to be computed is contiguous, the \fBmd5_calc()\fR function +can be used to generate the MD5 digest. + +.sp +.in +2 +.nf +int AuthenticateMsg(unsigned char *auth_buffer, unsigned + char *buffer, unsigned int length) +{ + md5_calc(buffer, auth_buffer, length); + + return (0); +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibmd5\fR(3LIB) +.sp +.LP +Rivest, R., The MD5 Message-Digest Algorithm, RFC 1321, April 1992. diff --git a/usr/src/man/man3ext/read_vtoc.3ext b/usr/src/man/man3ext/read_vtoc.3ext new file mode 100644 index 0000000000..22be2e315f --- /dev/null +++ b/usr/src/man/man3ext/read_vtoc.3ext @@ -0,0 +1,187 @@ +'\" te +.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH read_vtoc 3EXT "7 Oct 2008" "SunOS 5.11" "Extended Library Functions" +.SH NAME +read_vtoc, write_vtoc \- read and write a disk's VTOC +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-ladm\fR [ \fIlibrary\fR ... ] +#include <sys/vtoc.h> + +\fBint\fR \fBread_vtoc\fR(\fBint\fR \fIfd\fR, \fBstruct vtoc *\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBwrite_vtoc\fR(\fBint\fR \fIfd\fR, \fBstruct vtoc *\fR\fIvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBread_extvtoc\fR(\fBint\fR \fIfd\fR, \fBstruct extvtoc *\fR\fIextvtoc\fR); +.fi + +.LP +.nf +\fBint\fR \fBwrite_extvtoc\fR(\fBint\fR \fIfd\fR, \fBstruct extvtoc *\fR\fIextvtoc\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBread_vtoc()\fR and \fBread_extvtoc()\fR functions return the VTOC +(volume table of contents) structure that is stored on the disk associated +with the open file descriptor \fIfd\fR. On disks larger than 1 TB +\fBread_extvtoc()\fR must be used. +.sp +.LP +The \fBwrite_vtoc()\fR and \fBwrite_extvtoc()\fR function stores the VTOC +structure on the disk associated with the open file descriptor \fIfd\fR. On +disks larger then 1TB \fBwrite_extvtoc()\fR function must be used. +.sp +.LP +The \fIfd\fR argument refers to any slice on a raw disk. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBread_vtoc()\fR and \fBread_extvtoc()\fR return a +positive integer indicating the slice index associated with the open file +descriptor. Otherwise, they return a negative integer indicating one of the +following errors: +.sp +.ne 2 +.mk +.na +\fB\fBVT_EIO\fR\fR +.ad +.RS 15n +.rt +An I/O error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ENOTSUP\fR\fR +.ad +.RS 15n +.rt +This operation is not supported on this disk. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ERROR\fR\fR +.ad +.RS 15n +.rt +An unknown error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_OVERFLOW\fR\fR +.ad +.RS 15n +.rt +The caller attempted an operation that is illegal on the disk and may overflow +the fields in the data structure. +.RE + +.sp +.LP +Upon successful completion, \fBwrite_vtoc()\fR and \fBwrite_extvtoc()\fR return +0. Otherwise, they return a negative integer indicating one of the following +errors: +.sp +.ne 2 +.mk +.na +\fB\fBVT_EINVAL\fR\fR +.ad +.RS 15n +.rt +The VTOC contains an incorrect field. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_EIO\fR\fR +.ad +.RS 15n +.rt +An I/O error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ENOTSUP\fR\fR +.ad +.RS 15n +.rt +This operation is not supported on this disk. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_ERROR\fR\fR +.ad +.RS 15n +.rt +An unknown error occurred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBVT_OVERFLOW\fR\fR +.ad +.RS 15n +.rt +The caller attempted an operation that is illegal on the disk and may overflow +the fields in the data structure. +.RE + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +MT-LevelUnsafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBfmthard\fR(1M), \fBformat\fR(1M), \fBprtvtoc\fR(1M), \fBioctl\fR(2), +\fBefi_alloc_and_init\fR(3EXT), \fBattributes\fR(5), \fBdkio\fR(7I) +.SH BUGS +.sp +.LP +The \fBwrite_vtoc()\fR function cannot write a \fBVTOC\fR on an unlabeled +disk. Use \fBformat\fR(1M) for this purpose. diff --git a/usr/src/man/man3ext/rtld_audit.3ext b/usr/src/man/man3ext/rtld_audit.3ext new file mode 100644 index 0000000000..1be1629a08 --- /dev/null +++ b/usr/src/man/man3ext/rtld_audit.3ext @@ -0,0 +1,109 @@ +'\" te +.\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH rtld_audit 3EXT "6 Oct 2004" "SunOS 5.11" "Extended Library Functions" +.SH NAME +rtld_audit, la_activity, la_i86_pltenter, la_objsearch, la_objopen, +la_objfilter, la_pltexit, la_pltexit64, la_preinit, la_sparcv8_pltenter, +la_sparcv9_pltenter, la_amd64_pltenter, la_symbind32, la_symbind64, la_version +\- runtime linker auditing functions +.SH SYNOPSIS +.LP +.nf +\fBvoid\fR \fBla_activity\fR(\fBuintptr_t *\fR\fIcookie\fR, \fBuint_t\fR \fIflag\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_i86_pltenter\fR(\fBElf32_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, \fBuintptr_t *\fR\fIrefcook\fR, + \fBuintptr_t *\fR\fIdefcook\fR, \fBLa_i86_regs *\fR\fIregs\fR, \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBla_objsearch\fR(\fBconst char *\fR\fIname\fR, \fBuintptr_t *\fR\fIcookie\fR, \fBuint_t\fR \fIflag\fR); +.fi + +.LP +.nf +\fBuint_t\fR \fBla_objopen\fR(\fBLink_map *\fR\fIlmp\fR, \fBLmid_t\fR \fIlmid\fR, \fBuintptr_t *\fR\fIcookie\fR); +.fi + +.LP +.nf +\fBint\fR \fBla_objfilter\fR(\fBuintptr_t *\fR\fIfltrcook\fR, \fBuintptr_t *\fR\fIfltecook\fR, + \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_pltexit\fR(\fBElf32_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, \fBuintptr_t *\fR\fIrefcook\fR, + \fBuintptr_t *\fR\fIdefcook\fR, \fBuintptr_t\fR \fIretval\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_pltexit64\fR(\fBElf64_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, \fBuintptr_t *\fR\fIrefcook\fR, + \fBuintptr_t *\fR\fIdefcook\fR, \fBuintptr_t\fR \fIretval\fR, \fBconst char *\fR\fIsym_name\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBla_preinit\fR(\fBuintptr_t *\fR\fIcookie\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_sparcv8_pltenter\fR(\fBElf32_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, + \fBuintptr_t *\fR\fIrefcook\fR, \fBuintptr_t *\fR\fIdefcook\fR, \fBLa_amd64_regs *\fR\fIregs\fR, + \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_sparcv9_pltenter\fR(\fBElf64_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, + \fBuintptr_t *\fR\fIrefcook\fR, \fBuintptr_t *\fR\fIdefcook\fR, \fBLa_sparcv8_regs *\fR\fIregs\fR, + \fBuint_t *\fR\fIflags\fR, \fBconst char *\fR\fIsym_name\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_amd64_pltenter\fR(\fBElf32_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, + \fBuintptr_t *\fR\fIrefcook\fR, \fBuintptr_t *\fR\fIdefcook\fR, \fBLa_sparcv8_regs *\fR\fIregs\fR, + \fBuint_t *\fR\fIflags\fR, \fBconst char *\fR\fIsym_name\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_symbind32\fR(\fBElf32_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, \fBuintptr_t *\fR\fIrefcook\fR, + \fBuintptr_t *\fR\fIdefcook\fR, \fBuint_t *\fR\fIflags\fR); +.fi + +.LP +.nf +\fBuintptr_t\fR \fBla_symbind64\fR(\fBElf64_Sym *\fR\fIsym\fR, \fBuint_t\fR \fIndx\fR, + \fBuintptr_t *\fR\fIrefcook\fR,\fBuintptr_t *\fR\fIdefcook\fR, \fBuint_t *\fR\fIflags\fR, + \fBconst char *\fR\fIsym_name\fR); +.fi + +.LP +.nf +\fBuint_t\fR \fBla_version\fR(\fBuint_t\fR \fIversion\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +A runtime linker auditing library is a user-created shared object offering one +or more of these interfaces. The runtime linker \fBld.so.1\fR(1), calls these +interfaces during process execution. See the \fILinker and Libraries Guide\fR +for a full description of the link auditing mechanism. +.SH SEE ALSO +.sp +.LP +\fBld.so.1\fR(1) +.sp +.LP +\fILinker and Libraries Guide\fR diff --git a/usr/src/man/man3ext/rtld_db.3ext b/usr/src/man/man3ext/rtld_db.3ext new file mode 100644 index 0000000000..735fb2c66c --- /dev/null +++ b/usr/src/man/man3ext/rtld_db.3ext @@ -0,0 +1,126 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH rtld_db 3EXT "12 Oct 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +rtld_db, rd_delete, rd_errstr, rd_event_addr, rd_event_enable, rd_event_getmsg, +rd_init, rd_loadobj_iter, rd_log, rd_new, rd_objpad_enable, rd_plt_resolution, +rd_reset \- runtime linker debugging functions +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lrtld_db\fR [ \fIlibrary\fR ... ] +#include <proc_service.h> +#include <rtld_db.h> + +\fBvoid\fR \fBrd_delete\fR(\fBstruct rd_agent *\fR\fIrdap\fR); +.fi + +.LP +.nf +\fBchar *\fR\fBrd_errstr\fR(\fBrd_err_e\fR \fIrderr\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_event_addr\fR(\fBrd_agent *\fR\fIrdap\fR, \fBrd_notify_t *\fR\fInotify\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_event_enable\fR(\fBstruct rd_agent *\fR\fIrdap\fR, \fBint\fR \fIonoff\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_event_getmsg\fR(\fBstruct rd_agent *\fR\fIrdap\fR, + \fBrd_event_msg_t *\fR\fImsg\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_init\fR(\fBint\fR \fIversion\fR); +.fi + +.LP +.nf +\fBtypedef int\fR \fBrl_iter_f\fR(\fBconst rd_loadobj_t *,\fR void *); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_loadobj_iter\fR(\fBrd_agent_t *\fR\fIrap\fR, \fBrl_iter_f *\fR\fIcb\fR, + \fBvoid *\fR\fIclnt_data\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBrd_log\fR(\fBconst int\fR \fIonoff\fR); +.fi + +.LP +.nf +\fBrd_agent_t *\fR\fBrd_new\fR(\fBstruct ps_prochandle *\fR\fIphp\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_objpad_enable\fR(\fBstruct rd_agent *\fR\fIrdap\fR, \fBsize_t\fR \fIpadsize\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_plt_resolution\fR(\fBrd_agent *\fR\fIrdap\fR, \fBpaddr_t\fR \fIpc\fR, + \fBlwpid_t\fR \fIlwpid\fR, \fBpaddr_t\fR \fIplt_base\fR, \fBrd_plt_info_t *\fR\fIrpi\fR); +.fi + +.LP +.nf +\fBrd_err_e\fR \fBrd_reset\fR(\fBstruct rd_agent *\fR\fIrdap\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBlibrtld_db\fR library provides support for monitoring and manipulating +runtime linking aspects of a program. There are at least two processes +involved, the controlling process and one or more target processes. The +controlling process is the \fBlibrtld_db\fR client that links with +\fBlibrtld_db\fR and uses \fBlibrtld_db\fR to inspect or modify runtime linking +aspects of one or more target processes. See the \fILinker and Libraries +Guide\fR for a full description of the runtime linker debugger interface +mechanism. +.SH USAGE +.sp +.LP +To use \fBlibrtld_db\fR, applications need to implement the interfaces +documented in \fBps_pread\fR(3PROC) and \fBproc_service\fR(3PROC). +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for description of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBld.so.1\fR(1), \fBlibc_db\fR(3LIB), \fBlibrtld_db\fR(3LIB), +\fBproc_service\fR(3PROC), \fBps_pread\fR(3PROC), \fBattributes\fR(5) +.sp +.LP +\fILinker and Libraries Guide\fR diff --git a/usr/src/man/man3ext/sendfile.3ext b/usr/src/man/man3ext/sendfile.3ext new file mode 100644 index 0000000000..fc984d447f --- /dev/null +++ b/usr/src/man/man3ext/sendfile.3ext @@ -0,0 +1,287 @@ +'\" te +.\" Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH sendfile 3EXT "31 May 2006" "SunOS 5.11" "Extended Library Functions" +.SH NAME +sendfile \- send files over sockets or copy files to files +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lsendfile\fR [ \fIlibrary\fR\&.\|.\|. ] +#include <sys/sendfile.h> + +\fBssize_t\fR \fBsendfile\fR(\fBint\fR \fIout_fd\fR, \fBint\fR \fIin_fd\fR, \fBoff_t *\fR\fIoff\fR, \fBsize_t\fR \fIlen\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBsendfile()\fR function copies data from \fIin_fd\fR to \fIout_fd\fR +starting at offset \fIoff\fR and of length \fIlen\fR bytes. The \fIin_fd\fR +argument should be a file descriptor to a regular file opened for reading. See +\fBopen\fR(2). The \fIout_fd\fR argument should be a file descriptor to a +regular file opened for writing or to a connected \fBAF_INET\fR or +\fBAF_INET6\fR socket of \fBSOCK_STREAM\fR type. See \fBsocket\fR(3SOCKET). The +\fIoff\fR argument is a pointer to a variable holding the input file pointer +position from which the data will be read. After \fBsendfile()\fR has +completed, the variable will be set to the offset of the byte following the +last byte that was read. The \fBsendfile()\fR function does not modify the +current file pointer of \fIin_fd\fR, but does modify the file pointer for +\fIout_fd\fR if it is a regular file. +.sp +.LP +The \fBsendfile()\fR function can also be used to send buffers by pointing +\fIin_fd\fR to \fBSFV_FD_SELF\fR. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, \fBsendfile()\fR returns the total number of bytes +written to \fIout_fd\fR and also updates the offset to point to the byte that +follows the last byte read. Otherwise, it returns \fB-1\fR, and \fBerrno\fR is +set to indicate the error. +.SH ERRORS +.sp +.LP +The \fBsendfile()\fR function will fail if: +.sp +.ne 2 +.mk +.na +\fB\fBEAFNOSUPPORT\fR\fR +.ad +.RS 16n +.rt +The implementation does not support the specified address family for socket. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEAGAIN\fR\fR +.ad +.RS 16n +.rt +Mandatory file or record locking is set on either the file descriptor or output +file descriptor if it points at regular files. \fBO_NDELAY\fR or +\fBO_NONBLOCK\fR is set, and there is a blocking record lock. An attempt has +been made to write to a stream that cannot accept data with the \fBO_NDELAY\fR +or the \fBO_NONBLOCK\fR flag set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEBADF\fR\fR +.ad +.RS 16n +.rt +The \fIout_fd\fR or \fIin_fd\fR argument is either not a valid file descriptor, +\fIout_fd\fR is not opened for writing. or \fIin_fd\fR is not opened for +reading. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEINVAL\fR\fR +.ad +.RS 16n +.rt +The offset cannot be represented by the \fBoff_t\fR structure, or the length is +negative when cast to \fBssize_t\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEIO\fR\fR +.ad +.RS 16n +.rt +An I/O error occurred while accessing the file system. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBENOTCONN\fR\fR +.ad +.RS 16n +.rt +The socket is not connected. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEOPNOTSUPP\fR\fR +.ad +.RS 16n +.rt +The socket type is not supported. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEPIPE\fR\fR +.ad +.RS 16n +.rt +The \fIout_fd\fR argument is no longer connected to the peer endpoint. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEINTR\fR\fR +.ad +.RS 16n +.rt +A signal was caught during the write operation and no data was transferred. +.RE + +.SH USAGE +.sp +.LP +The \fBsendfile()\fR function has a transitional interface for 64-bit file +offsets. See \fBlf64\fR(5). +.SH EXAMPLES +.LP +\fBExample 1 \fRSending a Buffer Over a Socket +.sp +.LP +The following example demonstrates how to send the buffer \fIbuf\fR over a +socket. At the end, it prints the number of bytes transferred over the socket +from the buffer. It assumes that \fIaddr\fR will be filled up appropriately, +depending upon where to send the buffer. + +.sp +.in +2 +.nf +int tfd; +off_t baddr; +struct sockaddr_in sin; +char buf[64 * 1024]; +in_addr_t addr; +size_t len; + +tfd = socket(AF_INET, SOCK_STREAM, 0); +if (tfd == -1) { + perror("socket"); + exit(1); +} + +sin.sin_family = AF_INET; +sin.sin_addr.s_addr = addr; /* Fill in the appropriate address. */ +sin.sin_port = htons(2345); +if (connect(tfd, (struct sockaddr *)&sin, sizeof(sin))<0) { + perror("connect"); + exit(1); +} + +baddr = (off_t)buf; +len = sizeof(buf); +while (len > 0) { + ssize_t res; + res = sendfile(tfd, SFV_FD_SELF, &baddr, len); + if (res == -1) + if (errno != EINTR) { + perror("sendfile"); + exit(1); + } else continue; + len -= res; +} +.fi +.in -2 + +.LP +\fBExample 2 \fRTransferring Files to Sockets +.sp +.LP +The following program demonstrates a transfer of files to sockets: + +.sp +.in +2 +.nf +int ffd, tfd; +off_t off; +struct sockaddr_in sin; +in_addr_t addr; +int len; +struct stat stat_buf; +ssize_t len; + +ffd = open("file", O_RDONLY); +if (ffd == -1) { + perror("open"); + exit(1); +} + +tfd = socket(AF_INET, SOCK_STREAM, 0); +if (tfd == -1) { + perror("socket"); + exit(1); +} + +sin.sin_family = AF_INET; +sin.sin_addr = addr; /* Fill in the appropriate address. */ +sin.sin_port = htons(2345); +if (connect(tfd, (struct sockaddr *) &sin, sizeof(sin)) <0) { + perror("connect"); + exit(1); +} + +if (fstat(ffd, &stat_buf) == -1) { + perror("fstat"); + exit(1); +} + +len = stat_buf.st_size; +while (len > 0) { + ssize_t res; + res = sendfile(tfd, ffd, &off, len); + if (res == -1) + if (errno != EINTR) { + perror("sendfile"); + exit(1); + } else continue; + len -= res; +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityEvolving +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBopen\fR(2), \fBlibsendfile\fR(3LIB), \fBsendfilev\fR(3EXT), +\fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBlf64\fR(5) diff --git a/usr/src/man/man3ext/sendfilev.3ext b/usr/src/man/man3ext/sendfilev.3ext new file mode 100644 index 0000000000..78e1343172 --- /dev/null +++ b/usr/src/man/man3ext/sendfilev.3ext @@ -0,0 +1,318 @@ +'\" te +.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH sendfilev 3EXT "25 Feb 2009" "SunOS 5.11" "Extended Library Functions" +.SH NAME +sendfilev \- send a file +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lsendfile\fR [ \fIlibrary\fR... ] +#include <sys/sendfile.h> + +\fBssize_t\fR \fBsendfilev\fR(\fBint\fR \fIfildes\fR, \fBconst struct sendfilevec *\fR\fIvec\fR, + \fBint\fR \fIsfvcnt\fR, \fBsize_t *\fR\fIxferred\fR); +.fi + +.SH PARAMETERS +.sp +.LP +The \fBsendfilev()\fR function supports the following parameters: +.sp +.ne 2 +.mk +.na +\fB\fIfildes\fR\fR +.ad +.RS 11n +.rt +A file descriptor to a regular file or to a \fBAF_NCA\fR, \fBAF_INET\fR, or +\fBAF_INET6\fR family type \fBSOCK_STREAM\fR socket that is open for writing. +For \fBAF_NCA\fR, the protocol type should be zero. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fIvec\fR\fR +.ad +.RS 11n +.rt +An array of \fBSENDFILEVEC_T\fR, as defined in the \fBsendfilevec\fR structure +above. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fIsfvcnt\fR\fR +.ad +.RS 11n +.rt +The number of members in \fIvec\fR. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fIxferred\fR\fR +.ad +.RS 11n +.rt +The total number of bytes written to \fBout_fd\fR. +.RE + +.SH DESCRIPTION +.sp +.LP +The \fBsendfilev()\fR function attempts to write data from the \fIsfvcnt\fR +buffers specified by the members of \fIvec\fR array: \fBvec[0], vec[1], ... , +vec[sfvcnt-1]\fR. The \fIfildes\fR argument is a file descriptor to a regular +file or to an \fBAF_NCA\fR, \fBAF_INET\fR, or \fBAF_INET6\fR family type +\fBSOCK_STREAM\fR socket that is open for writing. +.sp +.LP +This function is analogous to \fBwritev\fR(2), but can read from both buffers +and file descriptors. Unlike \fBwritev()\fR, in the case of multiple writers to +a file the effect of \fBsendfilev()\fR is not necessarily atomic; the writes +may be interleaved. Application-specific synchronization methods must be +employed if this causes problems. +.sp +.LP +The following is the \fBsendfilevec\fR structure: +.sp +.in +2 +.nf +typedef struct sendfilevec { + int sfv_fd; /* input fd */ + uint_t sfv_flag; /* Flags. see below */ + off_t sfv_off; /* offset to start reading from */ + size_t sfv_len; /* amount of data */ +} sendfilevec_t; + +#define SFV_FD_SELF (-2) +.fi +.in -2 + +.sp +.LP +To send a file, open the file for reading and point \fBsfv_fd\fR to the file +descriptor returned as a result. See \fBopen\fR(2). \fBsfv_off\fR should +contain the offset within the file. \fBsfv_len\fR should have the length of the +file to be transferred. +.sp +.LP +The \fIxferred\fR argument is updated to record the total number of bytes +written to \fBout_fd\fR. +.sp +.LP +The \fBsfv_flag\fR field is reserved and should be set to zero. +.sp +.LP +To send data directly from the address space of the process, set \fBsfv_fd\fR +to \fBSFV_FD_SELF\fR. \fBsfv_off\fR should point to the data, with +\fBsfv_len\fR containing the length of the buffer. +.SH RETURN VALUES +.sp +.LP +Upon successful completion, the \fBsendfilev()\fR function returns total number +of bytes written to \fBout_fd\fR. Otherwise, it returns \fB-1\fR, and +\fBerrno\fR is set to indicate the error. The \fIxferred\fR argument contains +the amount of data successfuly transferred, which can be used to discover the +error vector. +.SH ERRORS +.sp +.ne 2 +.mk +.na +\fB\fBEACCES\fR\fR +.ad +.RS 16n +.rt +The process does not have appropriate privileges or one of the files pointed by +\fBsfv_fd\fR does not have appropriate permissions. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEAFNOSUPPORT\fR\fR +.ad +.RS 16n +.rt +The implementation does not support the specified address family for socket. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEAGAIN\fR\fR +.ad +.RS 16n +.rt +Mandatory file or record locking is set on either the file descriptor or output +file descriptor if it points at regular files. \fBO_NDELAY\fR or +\fBO_NONBLOCK\fR is set, and there is a blocking record lock. An attempt has +been made to write to a stream that cannot accept data with the \fBO_NDELAY\fR +or the \fBO_NONBLOCK\fR flag set. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEBADF\fR\fR +.ad +.RS 16n +.rt +The \fIfildes\fR argument is not a valid descriptor open for writing or an +\fBsfv_fd\fR is invalid or not open for reading. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEFAULT\fR\fR +.ad +.RS 16n +.rt +The \fIvec\fR argument points to an illegal address. +.sp +The \fIxferred\fR argument points to an illegal address. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEINTR\fR\fR +.ad +.RS 16n +.rt +A signal was caught during the write operation and no data was transferred. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEINVAL\fR\fR +.ad +.RS 16n +.rt +The \fIsfvcnt\fR argument was less than or equal to \fB0\fR. One of the +\fBsfv_len\fR values in \fIvec\fR array was less than or equal to \fB0\fR, or +greater than the file size. An \fBsfv_fd\fR is not seekable. +.sp +Fewer bytes were transferred than were requested. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEIO\fR\fR +.ad +.RS 16n +.rt +An I/O error occurred while accessing the file system. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEPIPE\fR\fR +.ad +.RS 16n +.rt +The \fIfildes\fR argument is a socket that has been shut down for writing. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBEPROTOTYPE\fR\fR +.ad +.RS 16n +.rt +The socket type is not supported. +.RE + +.SH USAGE +.sp +.LP +The \fBsendfilev()\fR function has a transitional interface for 64-bit file +offsets. See \fBlf64\fR(5). +.SH EXAMPLES +.sp +.LP +The following example sends 2 vectors, one of HEADER data and a file of length +100 over \fBsockfd\fR. \fBsockfd\fR is in a connected state, that is, +\fBsocket()\fR, \fBaccept()\fR, and \fBbind()\fR operation are complete. +.sp +.in +2 +.nf +#include <sys/sendfile.h> +\&. +\&. +\&. +int +main (int argc, char *argv[]){ + int sockfd; + ssize_t ret; + size_t xfer; + struct sendfilevec vec[2]; + . + . + . + vec[0].sfv_fd = SFV_FD_SELF; + vec[0].sfv_flag = 0; + vec[0].sfv_off = "HEADER_DATA"; + vec[0].sfv_len = strlen("HEADER_DATA"); + vec[1].sfv_fd = open("input_file",.... ); + vec[1].sfv_flag = 0; + vec[1].sfv_off = 0; + vec[1].sfv_len = 100; + + ret = sendfilev(sockfd, vec, 2, &xfer); +\&. +\&. +\&. +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBopen\fR(2), \fBwritev\fR(2), \fBlibsendfile\fR(3LIB), \fBsendfile\fR(3EXT), +\fBsocket\fR(3SOCKET), \fBattributes\fR(5) diff --git a/usr/src/man/man3ext/sha1.3ext b/usr/src/man/man3ext/sha1.3ext new file mode 100644 index 0000000000..0c65332c55 --- /dev/null +++ b/usr/src/man/man3ext/sha1.3ext @@ -0,0 +1,143 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH sha1 3EXT "13 Nov 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +sha1, SHA1Init, SHA1Update, SHA1Final \- SHA1 digest functions +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd\fR [ \fIlibrary\fR ... ] +#include <sha1.h> + +\fBvoid\fR \fBSHA1Init\fR(\fBSHA1_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA1Update\fR(\fBSHA1_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA1Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBSHA1_CTX *\fR\fIcontext\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBSHA1\fR functions implement the \fBSHA1\fR message-digest algorithm. The +algorithm takes as input a message of arbitrary length and produces a 200-bit +"fingerprint" or "message digest" as output. The \fBSHA1\fR message-digest +algorithm is intended for digital signature applications in which large files +are "compressed" in a secure manner before being encrypted with a private +(secret) key under a public-key cryptosystem such as RSA. +.sp +.ne 2 +.mk +.na +\fB\fBSHA1Init()\fR, \fBSHA1Update()\fR, \fBSHA1Final()\fR\fR +.ad +.sp .6 +.RS 4n +The \fBSHA1Init()\fR, \fBSHA1Update()\fR, and \fBSHA1Final()\fR functions allow +a \fBSHA1\fR digest to be computed over multiple message blocks. Between +blocks, the state of the \fBSHA1\fR computation is held in an \fBSHA1\fR +context structure allocated by the caller. A complete digest computation +consists of calls to \fBSHA1\fR functions in the following order: one call to +\fBSHA1Init()\fR, one or more calls to \fBSHA1Update()\fR, and one call to +\fBSHA1Final()\fR. +.sp +The \fBSHA1Init()\fR function initializes the \fBSHA1\fR context structure +pointed to by \fIcontext\fR. +.sp +The \fBSHA1Update()\fR function computes a partial \fBSHA1\fR digest on the +\fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the +\fBSHA1\fR context structure pointed to by \fIcontext\fR accordingly. +.sp +The \fBSHA1Final()\fR function generates the final \fBSHA1\fR digest, using the +\fBSHA1\fR context structure pointed to by \fIcontext\fR. The 16-bit \fBSHA1\fR +digest is written to output. After a call to \fBSHA1Final()\fR, the state of +the context structure is undefined. It must be reinitialized with +\fBSHA1Init()\fR before it can be used again. +.RE + +.SH SECURITY +.sp +.LP +The \fBSHA1\fR algorithm is also believed to have some weaknesses. Migration to +one of the \fBSHA2\fR algorithms-including \fBSHA256\fR, \fBSHA386\fR or +\fBSHA512\fR-is highly recommended when compatibility with data formats and on +wire protocols is permitted. +.SH RETURN VALUES +.sp +.LP +These functions do not return a value. +.SH EXAMPLES +.LP +\fBExample 1 \fRAuthenticate a message found in multiple buffers +.sp +.LP +The following is a sample function that authenticates a message found in +multiple buffers. The calling function provides an authentication buffer to +contain the result of the \fBSHA1\fR digest. + +.sp +.in +2 +.nf +#include <sys/types.h> +#include <sys/uio.h> +#include <sha1.h> + +int +AuthenticateMsg(unsigned char *auth_buffer, struct iovec + *messageIov, unsigned int num_buffers) +{ + SHA1_CTX sha1_context; + unsigned int i; + + SHA1Init(&sha1_context); + + for(i=0; i<num_buffers; i++) + { + SHA1Update(&sha1_context, messageIov->iov_base, + messageIov->iov_len); + messageIov += sizeof(struct iovec); + } + + SHA1Final(auth_buffer, &sha1_context); + + return 0; +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBsha2\fR(3EXT), \fBlibmd\fR(3LIB) +.sp +.LP +RFC 1374 diff --git a/usr/src/man/man3ext/sha2.3ext b/usr/src/man/man3ext/sha2.3ext new file mode 100644 index 0000000000..a957c5ceea --- /dev/null +++ b/usr/src/man/man3ext/sha2.3ext @@ -0,0 +1,240 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" 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] +.TH sha2 3EXT "13 Nov 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +sha2, SHA2Init, SHA2Update, SHA2Final, SHA256Init, SHA256Update, SHA256Final, +SHA384Init, SHA384Update, SHA384Final, SHA512Init, SHA512Update, SHA512Final \- +SHA2 digest functions +.SH SYNOPSIS +.LP +.nf +\fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lmd\fR [ \fIlibrary\fR ... ] +#include <sha2.h> + +\fBvoid\fR \fBSHA2Init\fR(\fBuint64_t\fR \fImech\fR, \fBSHA2_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA2Update\fR(\fBSHA2_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA2Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBSHA2_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA256Init\fR(\fBSHA256_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA256Update\fR(\fBSHA256_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA256Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fBSHA256_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA384Init\fR(\fBSHA384_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA384Update\fR(\fBSHA384_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA384Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fB384_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA512Init\fR(\fBSHA512_CTX *\fR\fIcontext\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA512Update\fR(\fBSHA512_CTX *\fR\fIcontext\fR, \fBunsigned char *\fR\fIinput\fR, + \fBunsigned int\fR \fIinlen\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBSHA512Final\fR(\fBunsigned char *\fR\fIoutput\fR, \fB512_CTX *\fR\fIcontext\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +The \fBSHA2Init()\fR, \fBSHA2Update()\fR, \fBSHA2Final()\fR functions implement +the \fBSHA256\fR, \fBSHA384\fR and \fBSHA512\fR message-digest algorithms. The +algorithms take as input a message of arbitrary length and produces a 200-bit +"fingerprint" or "message digest" as output. The \fBSHA2\fR message-digest +algorithms are intended for digital signature applications in which large files +are "compressed" in a secure manner before being encrypted with a private +(secret) key under a public-key cryptosystem such as RSA. +.sp +.ne 2 +.mk +.na +\fB\fBSHA2Init()\fR, \fBSHA2Update()\fR, \fBSHA2Final()\fR\fR +.ad +.sp .6 +.RS 4n +The \fBSHA2Init()\fR, \fBSHA2Update()\fR, and \fBSHA2Final()\fR functions allow +an \fBSHA2\fR digest to be computed over multiple message blocks. Between +blocks, the state of the \fBSHA2\fR computation is held in an \fBSHA2\fR +context structure allocated by the caller. A complete digest computation +consists of calls to \fBSHA2\fR functions in the following order: one call to +\fBSHA2Init()\fR, one or more calls to \fBSHA2Update()\fR, and one call to +\fBSHA2Final()\fR. +.sp +The \fBSHA2Init()\fR function initializes the SHA2 context structure pointed to +by \fIcontext\fR. The \fImech\fR argument is one of \fBSHA256\fR, \fBSHA512\fR, +\fBSHA384\fR. +.sp +The \fBSHA2Update()\fR function computes a partial \fBSHA2\fR digest on the +\fIinlen\fR-byte message block pointed to by \fIinput\fR, and updates the +\fBSHA2\fR context structure pointed to by \fIcontext\fR accordingly. +.sp +The \fBSHA2Final()\fR function generates the final \fBSHA2Final\fR digest, +using the \fBSHA2\fR context structure pointed to by \fIcontext\fR. The +\fBSHA2\fR digest is written to output. After a call to \fBSHA2Final()\fR, the +state of the context structure is undefined. It must be reinitialized with +\fBSHA2Init()\fR before it can be used again. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBSHA256Init()\fR, \fBSHA256Update()\fR, \fBSHA256Final()\fR, +\fBSHA384Init()\fR, \fBSHA384Update()\fR, \fBSHA384Final()\fR, +\fBSHA512Init()\fR, \fBSHA512Update()\fR, \fBSHA512Final()\fR\fR +.ad +.sp .6 +.RS 4n +Alternative APIs exist as named above. The \fBUpdate()\fR and \fBFinal()\fR +sets of functions operate exactly as the previously described +\fBSHA2Update()\fR and \fBSHA2Final()\fR functions. The \fBSHA256Init()\fR, +\fBSHA384Init()\fR, and \fBSHA512Init()\fR functions do not take the \fImech\fR +argument as it is implicit in the function names. +.RE + +.SH RETURN VALUES +.sp +.LP +These functions do not return a value. +.SH EXAMPLES +.LP +\fBExample 1 \fRAuthenticate a message found in multiple buffers +.sp +.LP +The following is a sample function that authenticates a message found in +multiple buffers. The calling function provides an authentication buffer to +contain the result of the \fBSHA2\fR digest. + +.sp +.in +2 +.nf +#include <sys/types.h> +#include <sys/uio.h> +#include <sha2.h> + +int +AuthenticateMsg(unsigned char *auth_buffer, struct iovec + *messageIov, unsigned int num_buffers) +{ + SHA2_CTX sha2_context; + unsigned int i; + + SHA2Init(SHA384, &sha2_context); + + for(i=0; i<num_buffers; i++) + { + SHA2Update(&sha2_context, messageIov->iov_base, + messageIov->iov_len); + messageIov += sizeof(struct iovec); + } + + SHA2Final(auth_buffer, &sha2_context); + + return 0; +} +.fi +.in -2 + +.LP +\fBExample 2 \fRAuthenticate a message found in multiple buffers +.sp +.LP +The following is a sample function that authenticates a message found in +multiple buffers. The calling function provides an authentication buffer that +will contain the result of the \fBSHA384\fR digest, using alternative +interfaces. + +.sp +.in +2 +.nf +int +AuthenticateMsg(unsigned char *auth_buffer, struct iovec + *messageIov, unsigned int num_buffers) +{ + SHA384_CTX ctx; + unsigned int i; + + SHA384Init(&ctx); + + for(i=0, i<num_buffers; i++ + { + SHA384Update(&ctx, messageIov->iov_base, + messageIov->iov_len); + messageIov += sizeof(struct iovec); + } + + SHA384Final(auth_buffer, &ctx); + + return 0; +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityCommitted +_ +MT-LevelMT-Safe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibmd\fR(3LIB) +.sp +.LP +FIPS 180-2 diff --git a/usr/src/man/man3ext/stdarg.3ext b/usr/src/man/man3ext/stdarg.3ext new file mode 100644 index 0000000000..29c9542daa --- /dev/null +++ b/usr/src/man/man3ext/stdarg.3ext @@ -0,0 +1,167 @@ +'\" te +.\" Copyright 1989 AT&T Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved +.\" 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] +.TH stdarg 3EXT "22 Mar 2006" "SunOS 5.11" "Extended Library Functions" +.SH NAME +stdarg \- handle variable argument list +.SH SYNOPSIS +.LP +.nf +#include <stdarg.h> +va_list \fIpvar\fR; + +\fBvoid\fR \fBva_start\fR(\fBva_list\fR \fIpvar\fR, \fBvoid\fR \fIname\fR); +.fi + +.LP +.nf +\fB(type *)\fR \fBva_arg\fR(\fBva_list\fR \fIpvar\fR, \fB\fR\fItype\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBva_copy\fR(\fBva_list\fR \fIdest\fR, \fBva_list\fR \fIsrc\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBva_end\fR(\fBva_list\fR \fIpvar\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +This set of macros allows portable procedures that accept variable numbers of +arguments of variable types to be written. Routines that have variable argument +lists (such as \fBprintf\fR) but do not use \fIstdarg\fR are inherently +non-portable, as different machines use different argument-passing conventions. +.sp +.LP +\fBva_list\fR is a type defined for the variable used to traverse the list. +.sp +.LP +The \fBva_start\fR macro is invoked before any access to the unnamed arguments +and initializes \fIpvar\fR for subsequent use by \fBva_arg()\fR and +\fBva_end()\fR. The parameter \fIname\fR is the identifier of the rightmost +parameter in the variable parameter list in the function definition (the one +just before the \fB, ...\fR). If this parameter is declared with the +\fBregister\fR storage class or with a function or array type, or with a type +that is not compatible with the type that results after application of the +default argument promotions, the behavior is undefined. +.sp +.LP +The parameter \fIname\fR is required under strict ANSI C compilation. In other +compilation modes, \fIname\fR need not be supplied and the second parameter to +the \fBva_start()\fR macro can be left empty (for example, \fBva_start(pvar, +);\fR). This allows for routines that contain no parameters before the +\fB\&...\fR in the variable parameter list. +.sp +.LP +The \fBva_arg()\fR macro expands to an expression that has the type and value +of the next argument in the call. The parameter \fBpvar\fR should have been +previously initialized by \fBva_start()\fR. Each invocation of \fBva_arg()\fR +modifies \fBpvar\fR so that the values of successive arguments are returned in +turn. The parameter \fBtype\fR is the type name of the next argument to be +returned. The type name must be specified in such a way so that the type of a +pointer to an object that has the specified type can be obtained simply by +postfixing a \fB*\fR to \fItype\fR. If there is no actual next argument, or if +\fItype\fR is not compatible with the type of the actual next argument (as +promoted according to the default argument promotions), the behavior is +undefined. +.sp +.LP +The \fBva_copy()\fR macro saves the state represented by the +\fBva_list\fR\fIsrc\fR in the \fBva_list\fR \fIdest\fR. The \fBva_list\fR +passed as \fIdest\fR should not be initialized by a previous call to +\fBva_start()\fR, and must be passed to \fBva_end()\fR before being reused as a +parameter to \fBva_start()\fR or as the \fIdest\fR parameter of a subsequent +call to \fBva_copy()\fR. The behavior is undefined should any of these +restrictions not be met. +.sp +.LP +The \fBva_end()\fR macro is used to clean up. +.sp +.LP +Multiple traversals, each bracketed by \fBva_start()\fR and \fBva_end()\fR, are +possible. +.SH EXAMPLES +.LP +\fBExample 1 \fRA sample program. +.sp +.LP +This example gathers into an array a list of arguments that are pointers to +strings (but not more than \fBMAXARGS\fR arguments) with function \fBf1\fR, +then passes the array as a single argument to function \fBf2\fR. The number of +pointers is specified by the first argument to \fBf1\fR. + +.sp +.in +2 +.nf +#include <stdarg.h> +#define MAXARGS 31 +void f1(int n_ptrs, ...) +{ + va_list ap; + char *array[MAXARGS]; + int ptr_no = 0; + + if (n_ptrs > MAXARGS) + n_ptrs = MAXARGS; + va_start(ap, n_ptrs); + while (ptr_no < n_ptrs) + array[ptr_no++] = va_arg(ap, char*); + va_end(ap); + f2(n_ptrs, array); +} +.fi +.in -2 + +.sp +.LP +Each call to \fBf1\fR shall have visible the definition of the function or a +declaration such as + +.sp +.in +2 +.nf +\fBvoid f1(int, ...)\fR +.fi +.in -2 +.sp + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityStandard +.TE + +.SH SEE ALSO +.sp +.LP +\fBvprintf\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5) +.SH NOTES +.sp +.LP +It is the responsibility of the calling routine to specify in some manner how +many arguments there are, since it is not always possible to determine the +number of arguments from the stack frame. For example, \fIexecl\fR is passed a +zero pointer to signal the end of the list. The \fIprintf\fR function can +determine the number of arguments by the format. It is non-portable to specify +a second argument of \fBchar\fR, \fBshort\fR, or \fBfloat\fR to \fBva_arg()\fR, +because arguments seen by the called function are not \fBchar\fR, \fBshort\fR, +or \fBfloat\fR. C converts \fBchar\fR and \fBshort\fR arguments to \fBint\fR +and converts \fBfloat\fR arguments to \fBdouble\fR before passing them to a +function. diff --git a/usr/src/man/man3ext/tsalarm_get.3ext b/usr/src/man/man3ext/tsalarm_get.3ext new file mode 100644 index 0000000000..93338600c5 --- /dev/null +++ b/usr/src/man/man3ext/tsalarm_get.3ext @@ -0,0 +1,345 @@ +'\" te +.\" Copyright (c) 2007, Sun Microsystems Inc. All Rights Reserved. +.\" 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] +.TH tsalarm_get 3EXT "4 Sep 2007" "SunOS 5.11" "Extended Library Functions" +.SH NAME +tsalarm_get, tsalarm_set \- get or set alarm relays +.SH SYNOPSIS +.LP +.nf +cc [ \fIflag\fR... ] \fIfile\fR... \fB-ltsalarm\fR [ \fIlibrary\fR... ] +#include <tsalarm.h> + +\fBint\fR \fBtsalarm_get\fR(\fBuint32_t\fR \fIalarm_type\fR, \fBuint32_t *\fR\fIalarm_state\fR); +.fi + +.LP +.nf +\fBint\fR \fBtsalarm_set\fR(\fBuint32_t\fR \fIalarm_type\fR, \fBuint32_t\fR \fIalarm_state\fR); +.fi + +.SH PARAMETERS +.sp +.ne 2 +.mk +.na +\fB\fIalarm_type\fR\fR +.ad +.sp .6 +.RS 4n +The alarm type whose state is retrieved or set. Valid settings are: +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_CRITICAL\fR\fR +.ad +.RS 20n +.rt +critical +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_MAJOR\fR\fR +.ad +.RS 20n +.rt +major +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_MINOR\fR\fR +.ad +.RS 20n +.rt +minor +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_USER\fR\fR +.ad +.RS 20n +.rt +user +.RE + +.RE + +.sp +.ne 2 +.mk +.na +\fB\fIalarm_state\fR\fR +.ad +.sp .6 +.RS 4n +The state of the alarm. Valid settings are: +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_STATE_ON\fR\fR +.ad +.RS 25n +.rt +The alarm state needs to be changed to "on", or is returned as "on". +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_STATE_OFF\fR\fR +.ad +.RS 25n +.rt +The alarm state needs to be changed to "off", or is returned as "off". +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_STATE_UNKNOWN\fR\fR +.ad +.RS 25n +.rt +The alarm state is returned as unknown. +.RE + +.RE + +.SH DESCRIPTION +.sp +.LP +The TSALARM interface provides functions through which alarm relays can be +controlled. The set of functions and data structures of this interface are +defined in the \fB<tsalarm.h>\fR header. +.sp +.LP +There are four alarm relays that are controlled by ILOM. Each alarm can be set +to "on" or "off" by using \fBtsalarm\fR interfaces provided from the host. The +four alarms are labeled as \fBcritical\fR, \fBmajor\fR, \fBminor\fR, and +\fBuser\fR. The user alarm is set by a user application depending on system +condition. LEDs in front of the box provide a visual indication of the four +alarms. The number of alarms and their meanings and labels can vary across +platforms. +.sp +.LP +The \fBtsalarm_get()\fR function gets the state of \fIalarm_type\fR and +returnsit in \fIalarm_state\fR. If successful, the function returns 0. +.sp +.LP +The \fBtsalarm_set()\fR function sets the state of \fIalarm_type\fR to the +value in \fIalarm_state\fR. If successful, the function returns 0. +.sp +.LP +The following structures are defined in \fB<tsalarm.h>\fR: +.sp +.in +2 +.nf +typedef struct tsalarm_req { + uint32_t alarm_id; + uint32_t alarm_action; +} tsalarm_req_t; +.fi +.in -2 + +.sp +.in +2 +.nf +typedef struct tsalarm_resp { + uint32_t status; + uint32_t alarm_id; + uint32_t alarm_state; +} tsalarm_resp_t; +.fi +.in -2 + +.SH RETURN VALUES +.sp +.LP +The \fBtsalarm_get()\fR and \fBtsalarm_set()\fR functions return the following +values: +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_CHANNEL_INIT_FAILURE\fR\fR +.ad +.sp .6 +.RS 4n +Channel initialization failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_COMM_FAILURE\fR\fR +.ad +.sp .6 +.RS 4n +Channel communication failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_NULL_REQ_DATA\fR\fR +.ad +.sp .6 +.RS 4n +Allocating memory for request data failed. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_SUCCESS\fR\fR +.ad +.sp .6 +.RS 4n +Successful completion. +.RE + +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_UNBOUND_PACKET_RECVD\fR\fR +.ad +.sp .6 +.RS 4n +An incorrect packet was received. +.RE + +.sp +.LP +The \fBtsalarm_get()\fR function returns the following value: +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_GET_ERROR\fR\fR +.ad +.RS 21n +.rt +An error occurred while getting the alarm state. +.RE + +.sp +.LP +The \fBtsalarm_set()\fR function returns the following value: +.sp +.ne 2 +.mk +.na +\fB\fBTSALARM_SET_ERROR\fR\fR +.ad +.RS 21n +.rt +An error occurred while setting the alarm state. +.RE + +.SH EXAMPLES +.LP +\fBExample 1 \fRGet and set an alarm state. +.sp +.LP +The following example demonstrates how to get and set an alarm state. + +.sp +.in +2 +.nf +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <tsalarm.h> + +void help(char *name) { + printf("Syntax: %s [get <type> | set <type> <state>]\en\en", name); + printf(" type = { critical, major, minor, user }\en"); + printf(" state = { on, off }\en\en"); + + exit(0); +} + +int main(int argc, char **argv) { + + uint32_t alarm_type, alarm_state; + + if (argc < 3) + help(argv[0]); + + if (strncmp(argv[2], "critical", 1) == 0) + alarm_type = TSALARM_CRITICAL; + else if (strncmp(argv[2], "major", 2) == 0) + alarm_type = TSALARM_MAJOR; + else if (strncmp(argv[2], "minor", 2) == 0) + alarm_type = TSALARM_MINOR; + else if (strncmp(argv[2], "user", 1) == 0) + alarm_type = TSALARM_USER; + else + help(argv[0]); + + if (strncmp(argv[1], "get", 1) == 0) { + tsalarm_get(alarm_type, &alarm_state); + printf("alarm = %d\etstate = %d\en", alarm_type, alarm_state); + } + else if (strncmp(argv[1], "set", 1) == 0) { + if (strncmp(argv[3], "on", 2) == 0) + alarm_state = TSALARM_STATE_ON; + else if (strncmp(argv[3], "off", 2) == 0) + alarm_state = TSALARM_STATE_OFF; + else + help(argv[0]); + + tsalarm_set(alarm_type, alarm_state); + } + else { + help(argv[0]); + } + + return 0; +} +.fi +.in -2 + +.SH ATTRIBUTES +.sp +.LP +See \fBattributes\fR(5) for descriptions of the following attributes: +.sp + +.sp +.TS +tab() box; +cw(2.75i) |cw(2.75i) +lw(2.75i) |lw(2.75i) +. +ATTRIBUTE TYPEATTRIBUTE VALUE +_ +Interface StabilityUncommitted +_ +MT-LevelSafe +.TE + +.SH SEE ALSO +.sp +.LP +\fBlibtsalarm\fR(3LIB), \fBattributes\fR(5) diff --git a/usr/src/man/man3ext/varargs.3ext b/usr/src/man/man3ext/varargs.3ext new file mode 100644 index 0000000000..8bdb4250f5 --- /dev/null +++ b/usr/src/man/man3ext/varargs.3ext @@ -0,0 +1,119 @@ +'\" te +.\" Copyright 1989 AT&T +.\" 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] +.TH varargs 3EXT "10 May 2002" "SunOS 5.11" "Extended Library Functions" +.SH NAME +varargs \- handle variable argument list +.SH SYNOPSIS +.LP +.nf +#include <varargs.h> +va_alist +va_dcl +va_list \fIpvar\fR; + +\fBvoid\fR \fBva_start\fR(\fBva_list\fR\fIpvar\fR); +.fi + +.LP +.nf +\fBtype\fR \fBva_arg\fR(\fBva_list\fR \fIpvar\fR, \fB\fR\fItype\fR); +.fi + +.LP +.nf +\fBvoid\fR \fBva_end\fR(\fBva_list\fR \fIpvar\fR); +.fi + +.SH DESCRIPTION +.sp +.LP +This set of macros allows portable procedures that accept variable argument +lists to be written. Routines that have variable argument lists (such as +\fBprintf\fR(3C)) but do not use \fBvarargs\fR are inherently non-portable, as +different machines use different argument-passing conventions. +.sp +.LP +\fBva_alist\fR is used as the parameter list in a function header. +.sp +.LP +\fBva_dcl\fR is a declaration for \fBva_alist\fR. No semicolon should follow +\fBva_dcl\fR. +.sp +.LP +\fBva_list\fR is a type defined for the variable used to traverse the list. +.sp +.LP +\fBva_start\fR is called to initialize \fBpvar\fR to the beginning of the list. +.sp +.LP +\fBva_arg\fR will return the next argument in the list pointed to by +\fBpvar\fR. \fBtype\fR is the type the argument is expected to be. Different +types can be mixed, but it is up to the routine to know what type of argument +is expected, as it cannot be determined at runtime. +.sp +.LP +\fBva_end\fR is used to clean up. +.sp +.LP +Multiple traversals, each bracketed by \fBva_start\fR and \fBva_end\fR, are +possible. +.SH EXAMPLES +.LP +\fBExample 1 \fRA sample program. +.sp +.LP +This example is a possible implementation of \fBexecl\fR (see \fBexec\fR(2) ). + +.sp +.in +2 +.nf +\fB#include <unistd.h> +#include <varargs.h> +#define MAXARGS 100 +/* execl is called by + execl(file, arg1, arg2, ..., (char *)0); +*/ +execl(va_alist) +va_dcl +{ + va_list ap; + char *file; + char *args[MAXARGS]; /* assumed big enough*/ + int argno = 0; + + va_start(ap); + file = va_arg(ap, char *); + while ((args[argno++] = va_arg(ap, char *)) != 0) + ; + va_end(ap); + return execv(file, args); +}\fR +.fi +.in -2 +.sp + +.SH SEE ALSO +.sp +.LP +\fBexec\fR(2), \fBprintf\fR(3C), \fBvprintf\fR(3C), \fBstdarg\fR(3EXT) +.SH NOTES +.sp +.LP +It is up to the calling routine to specify in some manner how many arguments +there are, since it is not always possible to determine the number of arguments +from the stack frame. For example, \fBexecl\fR is passed a zero pointer to +signal the end of the list. \fBprintf\fR can tell how many arguments are there +by the format. +.sp +.LP +It is non-portable to specify a second argument of \fBchar\fR, \fBshort\fR, or +\fBfloat\fR to \fBva_arg\fR, since arguments seen by the called function are +not \fBchar\fR, \fBshort\fR, or \fBfloat\fR. C converts \fBchar\fR and +\fBshort\fR arguments to \fBint\fR and converts \fBfloat\fR arguments to +\fBdouble\fR before passing them to a function. +.sp +.LP +\fBstdarg\fR is the preferred interface. |