components/openssl/openssl-1.0.1/engines/t4/eng_t4_sha2_asm.h
changeset 1158 227137d9fbce
parent 603 1b966e9a6b03
equal deleted inserted replaced
1157:65a016eaa866 1158:227137d9fbce
       
     1 /*
       
     2  * This product includes cryptographic software developed by the OpenSSL
       
     3  * Project for use in the OpenSSL Toolkit (http://www.openssl.org/). This
       
     4  * product includes cryptographic software written by Eric Young
       
     5  * ([email protected]).
       
     6  */
       
     7 
       
     8 /*
       
     9  * ====================================================================
       
    10  * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
       
    11  *
       
    12  * Redistribution and use in source and binary forms, with or without
       
    13  * modification, are permitted provided that the following conditions
       
    14  * are met:
       
    15  *
       
    16  * 1. Redistributions of source code must retain the above copyright
       
    17  *    notice, this list of conditions and the following disclaimer.
       
    18  *
       
    19  * 2. Redistributions in binary form must reproduce the above copyright
       
    20  *    notice, this list of conditions and the following disclaimer in
       
    21  *    the documentation and/or other materials provided with the
       
    22  *    distribution.
       
    23  *
       
    24  * 3. All advertising materials mentioning features or use of this
       
    25  *    software must display the following acknowledgment:
       
    26  *    "This product includes software developed by the OpenSSL Project
       
    27  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
       
    28  *
       
    29  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
       
    30  *    endorse or promote products derived from this software without
       
    31  *    prior written permission. For written permission, please contact
       
    32  *    [email protected].
       
    33  *
       
    34  * 5. Products derived from this software may not be called "OpenSSL"
       
    35  *    nor may "OpenSSL" appear in their names without prior written
       
    36  *    permission of the OpenSSL Project.
       
    37  *
       
    38  * 6. Redistributions of any form whatsoever must retain the following
       
    39  *    acknowledgment:
       
    40  *    "This product includes software developed by the OpenSSL Project
       
    41  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
       
    42  *
       
    43  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
       
    44  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    45  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       
    46  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
       
    47  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    48  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
       
    49  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
       
    50  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    51  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
       
    52  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
       
    53  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
       
    54  * OF THE POSSIBILITY OF SUCH DAMAGE.
       
    55  * ====================================================================
       
    56  */
       
    57 
       
    58 /*
       
    59  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
       
    60  */
       
    61 
       
    62 #ifndef	ENG_T4_SHA2_ASM_H
       
    63 #define	ENG_T4_SHA2_ASM_H
       
    64 
       
    65 /*
       
    66  * SPARC T4 SHA2 (SHA256/SHA512) assembly language functions and context.
       
    67  * The context must match that used by the Solaris SPARC T4 assembly
       
    68  * (except for OpenSSL-specific fields num and md_len that aren't in Solaris).
       
    69  *
       
    70  * Based on OpenSSL file openssl/sha.h and Solaris file sys/sha2.h.
       
    71  */
       
    72 
       
    73 #include <stddef.h>
       
    74 #include <sys/types.h>
       
    75 #include <openssl/sha.h>
       
    76 
       
    77 #ifdef	__cplusplus
       
    78 extern "C" {
       
    79 #endif
       
    80 
       
    81 #ifndef OPENSSL_NO_SHA256
       
    82 /*
       
    83  * The contents of this structure are a private interface between the
       
    84  * Init/Update/Multiblock/Final functions.
       
    85  * Callers must never attempt to read or write any of the fields
       
    86  * in this structure directly.
       
    87  */
       
    88 typedef struct t4_SHA256state_st {
       
    89 	uint32_t algotype;		/* Solaris-only field; unused here */
       
    90 	uint32_t algotype_pad;		/* Pad to align next field 0 mod 8 */
       
    91 	uint32_t h[8];			/* State (ABCDEFGH) */
       
    92 	uint32_t h_pad[8];		/* Pad fields to match T4_SHA512_CTX */
       
    93 	uint32_t Nl, Nh;		/* Number of bits, module 2^64 */
       
    94 	uint32_t Nl_pad, Nh_pad;	/* Pad fields to match T4_SHA512_CTX */
       
    95 	uint32_t data[SHA_LBLOCK];	/* Input */
       
    96 	unsigned int num, md_len;	/* Fields unused by Solaris assembly */
       
    97 } T4_SHA256_CTX;
       
    98 #endif	/* !OPENSSL_NO_SHA256 */
       
    99 
       
   100 
       
   101 #ifndef OPENSSL_NO_SHA512
       
   102 /*
       
   103  * The contents of this structure are a private interface between the
       
   104  * Init/Update/Multiblock/Final functions.
       
   105  * Callers must never attempt to read or write any of the fields
       
   106  * in this structure directly.
       
   107  */
       
   108 typedef struct t4_SHA512state_st {
       
   109 	uint32_t algotype;		/* Solaris-only field; unused here */
       
   110 	uint64_t h[8];			/* State (ABCDEFGH) */
       
   111 	uint64_t Nl, Nh;		/* Number of bits, module 2^128 */
       
   112 	union {
       
   113 		uint64_t	d[SHA_LBLOCK];
       
   114 		unsigned char	p[SHA512_CBLOCK];
       
   115 	} u;				/* Input */
       
   116 	unsigned int num, md_len;	/* Fields unused by Solaris assembly */
       
   117 } T4_SHA512_CTX;
       
   118 #endif	/* !OPENSSL_NO_SHA512 */
       
   119 
       
   120 /*
       
   121  * SPARC T4 assembly language functions
       
   122  */
       
   123 #ifndef	OPENSSL_NO_SHA256
       
   124 extern void t4_sha256_multiblock(T4_SHA256_CTX *c, const void *input,
       
   125 	size_t num);
       
   126 #endif
       
   127 #ifndef	OPENSSL_NO_SHA512
       
   128 extern void t4_sha512_multiblock(T4_SHA512_CTX *c, const void *input,
       
   129 	size_t num);
       
   130 #endif
       
   131 
       
   132 #ifdef	__cplusplus
       
   133 }
       
   134 #endif
       
   135 #endif	/* ENG_T4_SHA2_ASM_H */