| 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 | |
| 40 | extern const struct ccdigest_info ccsha256_v6m_di; |
| 41 | void ccsha256_v6m_compress(ccdigest_state_t state, size_t nblocks, const void *buf); |
| 42 | |
| 43 | void ccsha256_ltc_compress(ccdigest_state_t state, size_t nblocks, const void *buf); |
| 44 | void ccsha512_ltc_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 45 | |
| 46 | #if CCSHA2_VNG_INTEL |
| 47 | #if defined __x86_64__ |
| 48 | void ccsha256_vng_intel_avx2_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 49 | void ccsha256_vng_intel_avx1_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 50 | void ccsha256_vng_intel_ssse3_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 51 | void ccsha512_vng_intel_avx2_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 52 | void ccsha512_vng_intel_avx1_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 53 | void ccsha512_vng_intel_ssse3_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 54 | |
| 55 | extern const struct ccdigest_info ccsha224_vng_intel_AVX2_di; |
| 56 | extern const struct ccdigest_info ccsha224_vng_intel_AVX1_di; |
| 57 | extern const struct ccdigest_info ccsha256_vng_intel_AVX2_di; |
| 58 | extern const struct ccdigest_info ccsha256_vng_intel_AVX1_di; |
| 59 | extern const struct ccdigest_info ccsha384_vng_intel_AVX2_di; |
| 60 | extern const struct ccdigest_info ccsha384_vng_intel_AVX1_di; |
| 61 | extern const struct ccdigest_info ccsha384_vng_intel_SupplementalSSE3_di; |
| 62 | extern const struct ccdigest_info ccsha512_vng_intel_AVX2_di; |
| 63 | extern const struct ccdigest_info ccsha512_vng_intel_AVX1_di; |
| 64 | extern const struct ccdigest_info ccsha512_vng_intel_SupplementalSSE3_di; |
| 65 | #endif |
| 66 | void ccsha256_vng_intel_sse3_compress(ccdigest_state_t state, size_t nblocks, const void *in); |
| 67 | #endif |
| 68 | |
| 69 | #if CCSHA2_VNG_ARMV7NEON |
| 70 | extern const struct ccdigest_info ccsha384_vng_arm64_di; |
| 71 | extern const struct ccdigest_info ccsha384_vng_armv7neon_di; |
| 72 | extern const struct ccdigest_info ccsha512_vng_arm64_di; |
| 73 | extern const struct ccdigest_info ccsha512_vng_armv7neon_di; |
| 74 | #endif |
| 75 | |
| 76 | extern const uint32_t ccsha256_K[64]; |
| 77 | extern const uint64_t ccsha512_K[80]; |
| 78 | |
| 79 | void ccsha512_final(const struct ccdigest_info *di, ccdigest_ctx_t ctx, unsigned char *digest); |
| 80 | |
| 81 | extern const uint32_t ccsha224_initial_state[8]; |
| 82 | extern const uint32_t ccsha256_initial_state[8]; |
| 83 | extern const uint64_t ccsha384_initial_state[8]; |
| 84 | extern const uint64_t ccsha512_initial_state[8]; |
| 85 | |
| 86 | |
| 87 | #endif /* _CORECRYPTO_CCSHA2_INTERNAL_H_ */ |
| 88 | |