xref: /titanic_51/usr/src/man/man3c/crypt_genhash_impl.3c (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
te
Copyright (c) 2002, 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]
CRYPT_GENHASH_IMPL 3C "Jun 10, 2002"
NAME
crypt_genhash_impl - generate encrypted password
SYNOPSIS

#include <crypt.h>

char *crypt_genhash_impl(char *ctbuffer, size_t ctbufflen,
 const char *plaintext, const char *salt, const char **params);
DESCRIPTION

The crypt_genhash_impl() function is called by crypt(3C) to generate the encrypted password plaintext.

The ctbuffer argument is a pointer to an MT-safe buffer of ctbufflen size that is used to return the result.

The salt argument is the salt used in encoding.

The params argument is an argv-like null-terminated vector of type char *. The first element of params represents the mechanism token name from crypt.conf(4). The remaining elements of params represent strings of the form <parameter>[=<value>] to allow passing in additional information from the crypt.conf entry, such as specifing rounds information "rounds=4096".

The crypt_genhash_impl() function must not free(3C) ctbufflen on error.

RETURN VALUES

Upon successful completion, crypt_genhash_impl() returns a pointer to the encoded version of plaintext. Otherwise a null pointer is returned and errno is set to indicate the error.

ERRORS

The crypt_genhash_impl() function will fail if: EINVAL

The configuration file crypt.conf contains an invalid entry.

ELIBACC

The required shared library was not found.

ENOMEM

There is insufficient memory to perform hashing.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO

passwd(1), crypt(3C), crypt_gensalt_impl(3C), free(3C), getpassphrase(3C), crypt.conf(4), passwd(4), attributes(5)