md5_mod.c revision d3b2efc749bec3b757d5f018cf78c9a09fa29cb3
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CDDL HEADER START
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The contents of this file are subject to the terms of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Common Development and Distribution License (the "License").
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * You may not use this file except in compliance with the License.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * See the License for the specific language governing permissions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * and limitations under the License.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * When distributing Covered Code, include this CDDL HEADER in each
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * If applicable, add the following below this CDDL HEADER, with the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * fields enclosed by brackets "[]" replaced with your own identifying
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CDDL HEADER END
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Use is subject to license terms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * In kernel module, the md5 module is created with two modlinkages:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - a modlmisc that allows consumers to directly call the entry points
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * MD5Init, MD5Update, and MD5Final.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * - a modlcrypto that allows the module to register with the Kernel
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Cryptographic Framework (KCF) as a software provider for the MD5
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * mechanisms.
(void *)&modlmisc,
(void *)&modlcrypto,
typedef enum md5_mech_type {
typedef struct md5_ctx {
} md5_ctx_t;
typedef struct md5_hmac_ctx {
0, 0, CRYPTO_KEYSIZE_UNIT_IN_BITS},
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
{&modlinkage},
NULL,
_init(void)
int ret;
return (ret);
_fini(void)
int ret;
return (ret);
return (CRYPTO_MECHANISM_INVALID);
return (CRYPTO_HOST_MEMORY);
return (CRYPTO_SUCCESS);
return (CRYPTO_ARGUMENTS_BAD);
return (CRYPTO_DATA_LEN_RANGE);
vec_idx++;
offset = 0;
return (CRYPTO_DATA_LEN_RANGE);
return (CRYPTO_SUCCESS);
return (CRYPTO_ARGUMENTS_BAD);
return (CRYPTO_DATA_LEN_RANGE);
md5_ctx);
cur_len);
vec_idx++;
offset = 0;
return (CRYPTO_DATA_LEN_RANGE);
return (CRYPTO_SUCCESS);
return (CRYPTO_DATA_LEN_RANGE);
offset = 0;
return (CRYPTO_DATA_LEN_RANGE);
return (CRYPTO_SUCCESS);
return (CRYPTO_DATA_LEN_RANGE);
offset = 0;
return (CRYPTO_DATA_LEN_RANGE);
return (CRYPTO_SUCCESS);
return (CRYPTO_BUFFER_TOO_SMALL);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
data);
case CRYPTO_DATA_MBLK:
data);
return (ret);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
data);
case CRYPTO_DATA_MBLK:
data);
return (ret);
return (CRYPTO_BUFFER_TOO_SMALL);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
return (CRYPTO_MECHANISM_INVALID);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
uint_t i;
for (i = 0; i < MD5_HMAC_INTS_PER_BLOCK; i++) {
return (CRYPTO_MECHANISM_INVALID);
return (CRYPTO_ARGUMENTS_BAD);
return (CRYPTO_HOST_MEMORY);
sizeof (md5_hmac_ctx_t));
return (ret);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
return (CRYPTO_BUFFER_TOO_SMALL);
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
case CRYPTO_DATA_RAW: \
case CRYPTO_DATA_UIO: \
case CRYPTO_DATA_MBLK: \
data); \
return (CRYPTO_MECHANISM_INVALID);
return (CRYPTO_ARGUMENTS_BAD);
goto bail;
goto bail;
goto bail;
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
return (ret);
bail:
return (ret);
return (CRYPTO_MECHANISM_INVALID);
return (CRYPTO_ARGUMENTS_BAD);
goto bail;
goto bail;
goto bail;
goto bail;
case CRYPTO_DATA_RAW:
case CRYPTO_DATA_UIO: {
return (CRYPTO_ARGUMENTS_BAD);
for (vec_idx = 0;
cur_len) != 0) {
vec_idx++;
offset = 0;
case CRYPTO_DATA_MBLK: {
offset = 0;
return (ret);
bail:
return (ret);
return (CRYPTO_MECHANISM_INVALID);
return (CRYPTO_ARGUMENTS_BAD);
return (CRYPTO_HOST_MEMORY);
return (CRYPTO_SUCCESS);
return (CRYPTO_SUCCESS);
return (CRYPTO_SUCCESS);