1/*
2 * ccsha2_internal.h
3 * corecrypto
4 *
5 * Created on 12/19/2017
6 *
7 * Copyright (c) 2017 Apple Inc. All rights reserved.
8 *
9 *
10 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
11 *
12 * This file contains Original Code and/or Modifications of Original Code
13 * as defined in and that are subject to the Apple Public Source License
14 * Version 2.0 (the 'License'). You may not use this file except in
15 * compliance with the License. The rights granted to you under the License
16 * may not be used to create, or enable the creation or redistribution of,
17 * unlawful or unlicensed copies of an Apple operating system, or to
18 * circumvent, violate, or enable the circumvention or violation of, any
19 * terms of an Apple operating system software license agreement.
20 *
21 * Please obtain a copy of the License at
22 * http://www.opensource.apple.com/apsl/ and read it before using this file.
23 *
24 * The Original Code and all software distributed under the License are
25 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
26 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
27 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
29 * Please see the License for the specific language governing rights and
30 * limitations under the License.
31 *
32 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
33 */
34
35#ifndef _CORECRYPTO_CCSHA2_INTERNAL_H_
36#define _CORECRYPTO_CCSHA2_INTERNAL_H_
37
38#include <corecrypto/ccdigest.h>
39
40extern const struct ccdigest_info ccsha256_v6m_di;
41void ccsha256_v6m_compress(ccdigest_state_t state, size_t nblocks, const void *buf);
42
43void ccsha256_ltc_compress(ccdigest_state_t state, size_t nblocks, const void *buf);
44void ccsha512_ltc_compress(ccdigest_state_t state, size_t nblocks, const void *in);
45
46#if CCSHA2_VNG_INTEL
47#if defined __x86_64__
48void ccsha256_vng_intel_avx2_compress(ccdigest_state_t state, size_t nblocks, const void *in);
49void ccsha256_vng_intel_avx1_compress(ccdigest_state_t state, size_t nblocks, const void *in);
50void ccsha256_vng_intel_ssse3_compress(ccdigest_state_t state, size_t nblocks, const void *in);
51void ccsha512_vng_intel_avx2_compress(ccdigest_state_t state, size_t nblocks, const void *in);
52void ccsha512_vng_intel_avx1_compress(ccdigest_state_t state, size_t nblocks, const void *in);
53void ccsha512_vng_intel_ssse3_compress(ccdigest_state_t state, size_t nblocks, const void *in);
54
55extern const struct ccdigest_info ccsha224_vng_intel_AVX2_di;
56extern const struct ccdigest_info ccsha224_vng_intel_AVX1_di;
57extern const struct ccdigest_info ccsha256_vng_intel_AVX2_di;
58extern const struct ccdigest_info ccsha256_vng_intel_AVX1_di;
59extern const struct ccdigest_info ccsha384_vng_intel_AVX2_di;
60extern const struct ccdigest_info ccsha384_vng_intel_AVX1_di;
61extern const struct ccdigest_info ccsha384_vng_intel_SupplementalSSE3_di;
62extern const struct ccdigest_info ccsha512_vng_intel_AVX2_di;
63extern const struct ccdigest_info ccsha512_vng_intel_AVX1_di;
64extern const struct ccdigest_info ccsha512_vng_intel_SupplementalSSE3_di;
65#endif
66void ccsha256_vng_intel_sse3_compress(ccdigest_state_t state, size_t nblocks, const void *in);
67#endif
68
69#if CCSHA2_VNG_ARMV7NEON
70extern const struct ccdigest_info ccsha384_vng_arm64_di;
71extern const struct ccdigest_info ccsha384_vng_armv7neon_di;
72extern const struct ccdigest_info ccsha512_vng_arm64_di;
73extern const struct ccdigest_info ccsha512_vng_armv7neon_di;
74#endif
75
76extern const uint32_t ccsha256_K[64];
77extern const uint64_t ccsha512_K[80];
78
79void ccsha512_final(const struct ccdigest_info *di, ccdigest_ctx_t ctx, unsigned char *digest);
80
81extern const uint32_t ccsha224_initial_state[8];
82extern const uint32_t ccsha256_initial_state[8];
83extern const uint64_t ccsha384_initial_state[8];
84extern const uint64_t ccsha512_initial_state[8];
85
86
87#endif /* _CORECRYPTO_CCSHA2_INTERNAL_H_ */
88