b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao/*
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * CDDL HEADER START
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao *
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * The contents of this file are subject to the terms of the
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * Common Development and Distribution License (the "License").
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * You may not use this file except in compliance with the License.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao *
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * or http://www.opensolaris.org/os/licensing.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * See the License for the specific language governing permissions
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * and limitations under the License.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao *
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * When distributing Covered Code, include this CDDL HEADER in each
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * If applicable, add the following below this CDDL HEADER, with the
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * fields enclosed by brackets "[]" replaced with your own identifying
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * information: Portions Copyright [yyyy] [name of copyright owner]
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao *
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * CDDL HEADER END
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao/*
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * Use is subject to license terms.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#ifndef _SHA2_IMPL_H
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#define _SHA2_IMPL_H
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#ifdef __cplusplus
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chaoextern "C" {
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#endif
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chaotypedef enum {
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA1_TYPE,
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA256_TYPE,
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA384_TYPE,
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA512_TYPE
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao} sha2_mech_t;
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#ifdef _KERNEL
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao/*
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * Context for SHA2 mechanism.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chaotypedef struct sha2_ctx {
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao sha2_mech_type_t sc_mech_type; /* type of context */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA2_CTX sc_sha2_ctx; /* SHA2 context */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao} sha2_ctx_t;
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao/*
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao * Context for SHA2 HMAC and HMAC GENERAL mechanisms.
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chaotypedef struct sha2_hmac_ctx {
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao sha2_mech_type_t hc_mech_type; /* type of context */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao uint32_t hc_digest_len; /* digest len in bytes */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA2_CTX hc_icontext; /* inner SHA2 context */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao SHA2_CTX hc_ocontext; /* outer SHA2 context */
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao} sha2_hmac_ctx_t;
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#endif
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#ifdef __cplusplus
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao}
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#endif
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao
b5a2d8455dfa3190fc977c4bec53e91c99012767Hai-May Chao#endif /* _SHA2_IMPL_H */