]> git.saurik.com Git - apple/xnu.git/blobdiff - EXTERNAL_HEADERS/corecrypto/ccsha2.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / ccsha2.h
index e80c70e9e26891cb607006d1b798609f6ecf0265..7246269b30d94a032670b3027c098de11a7a7e21 100644 (file)
@@ -1,11 +1,12 @@
-/*
- *  ccsha2.h
- *  corecrypto
- *
- *  Created on 12/03/2010
- *
- *  Copyright (c) 2010,2011,2012,2014,2015 Apple Inc. All rights reserved.
+/* Copyright (c) (2010,2011,2012,2014,2015,2016,2017,2018,2019) Apple Inc. All rights reserved.
  *
+ * corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which
+ * is contained in the License.txt file distributed with corecrypto) and only to 
+ * people who accept that license. IMPORTANT:  Any license rights granted to you by 
+ * Apple Inc. (if any) are limited to internal use within your organization only on 
+ * devices and computers you own or control, for the sole purpose of verifying the 
+ * security characteristics and correct functioning of the Apple Software.  You may 
+ * not, directly or indirectly, redistribute the Apple Software or any portions thereof.
  */
 
 #ifndef _CORECRYPTO_CCSHA2_H_
@@ -18,8 +19,8 @@ const struct ccdigest_info *ccsha224_di(void);
 const struct ccdigest_info *ccsha256_di(void);
 const struct ccdigest_info *ccsha384_di(void);
 const struct ccdigest_info *ccsha512_di(void);
+const struct ccdigest_info *ccsha512_256_di(void);  // SHA512/256 (cf FIPS 180-4 https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf)
 
-/* TODO: Placeholders */
 #define ccoid_sha224 ((unsigned char *)"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04")
 #define ccoid_sha224_len 11
 
@@ -32,6 +33,8 @@ const struct ccdigest_info *ccsha512_di(void);
 #define ccoid_sha512 ((unsigned char *)"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03")
 #define ccoid_sha512_len 11
 
+#define ccoid_sha512_256 ((unsigned char *)"\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x06")
+#define ccoid_sha512_256_len 11
 
 /* SHA256 */
 #define CCSHA256_BLOCK_SIZE  64
@@ -50,6 +53,7 @@ extern const struct ccdigest_info ccsha256_vng_arm64neon_di;
 #endif  // CC_ACCELERATECRYPTO
 extern const struct ccdigest_info ccsha384_vng_arm_di;
 extern const struct ccdigest_info ccsha512_vng_arm_di;
+extern const struct ccdigest_info ccsha512_256_vng_arm_di;
 #endif
 
 /* SHA224 */
@@ -62,6 +66,14 @@ extern const struct ccdigest_info ccsha224_ltc_di;
 #define        CCSHA512_STATE_SIZE   64
 extern const struct ccdigest_info ccsha512_ltc_di;
 
+/* SHA512/256 */
+// FIPS 180-4
+// https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf
+#define CCSHA512_256_BLOCK_SIZE  128
+#define CCSHA512_256_OUTPUT_SIZE  32
+#define CCSHA512_256_STATE_SIZE   64
+extern const struct ccdigest_info ccsha512_256_ltc_di;
+
 /* SHA384 */
 #define        CCSHA384_OUTPUT_SIZE  48
 extern const struct ccdigest_info ccsha384_ltc_di;