Skip to content

Commit

Permalink
xnu-2782.1.97
Browse files Browse the repository at this point in the history
  • Loading branch information
Darwin authored and das committed Jun 4, 2017
1 parent bf0ce81 commit 0e29ffd
Show file tree
Hide file tree
Showing 1,290 changed files with 122,214 additions and 80,013 deletions.
59 changes: 31 additions & 28 deletions EXTERNAL_HEADERS/Availability.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,34 +116,37 @@
*/

#define __MAC_10_0 1000
#define __MAC_10_1 1010
#define __MAC_10_2 1020
#define __MAC_10_3 1030
#define __MAC_10_4 1040
#define __MAC_10_5 1050
#define __MAC_10_6 1060
#define __MAC_10_7 1070
#define __MAC_10_8 1080
#define __MAC_10_9 1090
#define __MAC_NA 9999 /* not available */

#define __IPHONE_2_0 20000
#define __IPHONE_2_1 20100
#define __IPHONE_2_2 20200
#define __IPHONE_3_0 30000
#define __IPHONE_3_1 30100
#define __IPHONE_3_2 30200
#define __IPHONE_4_0 40000
#define __IPHONE_4_1 40100
#define __IPHONE_4_2 40200
#define __IPHONE_4_3 40300
#define __IPHONE_5_0 50000
#define __IPHONE_5_1 50100
#define __IPHONE_6_0 60000
#define __IPHONE_6_1 60100
#define __IPHONE_7_0 70000
#define __IPHONE_NA 99999 /* not available */
#define __MAC_10_0 1000
#define __MAC_10_1 1010
#define __MAC_10_2 1020
#define __MAC_10_3 1030
#define __MAC_10_4 1040
#define __MAC_10_5 1050
#define __MAC_10_6 1060
#define __MAC_10_7 1070
#define __MAC_10_8 1080
#define __MAC_10_9 1090
#define __MAC_10_10 101000
/* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */

#define __IPHONE_2_0 20000
#define __IPHONE_2_1 20100
#define __IPHONE_2_2 20200
#define __IPHONE_3_0 30000
#define __IPHONE_3_1 30100
#define __IPHONE_3_2 30200
#define __IPHONE_4_0 40000
#define __IPHONE_4_1 40100
#define __IPHONE_4_2 40200
#define __IPHONE_4_3 40300
#define __IPHONE_5_0 50000
#define __IPHONE_5_1 50100
#define __IPHONE_6_0 60000
#define __IPHONE_6_1 60100
#define __IPHONE_7_0 70000
#define __IPHONE_7_1 70100
#define __IPHONE_8_0 80000
/* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */

#include <AvailabilityInternal.h>

Expand Down
1,478 changes: 1,476 additions & 2 deletions EXTERNAL_HEADERS/AvailabilityInternal.h

Large diffs are not rendered by default.

354 changes: 269 additions & 85 deletions EXTERNAL_HEADERS/AvailabilityMacros.h

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions EXTERNAL_HEADERS/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ INSTINC_SUBDIRS = \
INSTINC_SUBDIRS_X86_64 = \
architecture

INSTINC_SUBDIRS_X86_64H = \
architecture

INSTINC_SUBDIRS_ARM = \
architecture

Expand All @@ -22,6 +25,9 @@ EXPORT_FILES = \
Availability.h \
AvailabilityInternal.h \
AvailabilityMacros.h \
stddef.h

KERNEL_FILES = \
stdarg.h \
stdbool.h \
stdint.h
Expand All @@ -30,11 +36,11 @@ INSTALL_MI_LIST =

INSTALL_MI_DIR = .

INSTALL_KF_MI_LIST = ${EXPORT_FILES}
INSTALL_KF_MI_LIST = ${KERNEL_FILES}

INSTALL_KF_MI_LCL_LIST = ${EXPORT_FILES}
INSTALL_KF_MI_LCL_LIST = ${KERNEL_FILES}

EXPORT_MI_LIST = ${EXPORT_FILES} stddef.h
EXPORT_MI_LIST = ${EXPORT_FILES} ${KERNEL_FILES}

EXPORT_MI_DIR = .

Expand Down
3 changes: 3 additions & 0 deletions EXTERNAL_HEADERS/architecture/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ INSTINC_SUBDIRS =
INSTINC_SUBDIRS_X86_64 = \
i386

INSTINC_SUBDIRS_X86_64H = \
i386

INSTINC_SUBDIRS_ARM = \
arm

Expand Down
19 changes: 15 additions & 4 deletions EXTERNAL_HEADERS/corecrypto/cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
#include <string.h>
#include <stdint.h>

#if KERNEL
#if CC_KERNEL
#include <kern/assert.h>
#else
#include <assert.h>
#include <stdio.h>
#endif

/* Declare a struct element with a guarenteed alignment of _alignment_.
Expand All @@ -37,12 +38,22 @@
#define cc_ctx_decl(_type_, _size_, _name_) \
_type_ _name_[cc_ctx_n(_type_, _size_)]

#if CC_HAS_BZERO
#define cc_zero(_size_,_data_) bzero((_data_), (_size_))
#else
/* Alternate version if you don't have bzero. */
#define cc_zero(_size_,_data_) memset((_data_),0 ,(_size_))
#endif

#define cc_copy(_size_, _dst_, _src_) memcpy(_dst_, _src_, _size_)
#if CC_KERNEL
#define cc_printf(x...) printf(x)
#else
#define cc_printf(x...) fprintf(stderr, x)
#endif

#define cc_assert(x) assert(x)

#define cc_ctx_clear(_type_, _size_, _name_) \
cc_zero((_size_ + sizeof(_type_) - 1) / sizeof(_type_), _name_)
#define cc_copy(_size_, _dst_, _src_) memcpy(_dst_, _src_, _size_)

CC_INLINE CC_NONNULL2 CC_NONNULL3 CC_NONNULL4
void cc_xor(size_t size, void *r, const void *s, const void *t) {
Expand Down
149 changes: 147 additions & 2 deletions EXTERNAL_HEADERS/corecrypto/cc_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,108 @@
* Copyright 2010,2011 Apple Inc. All rights reserved.
*
*/

#ifndef _CORECRYPTO_CC_CONFIG_H_
#define _CORECRYPTO_CC_CONFIG_H_

/* A word about configuration macros:
Conditional configuration macros specific to corecrypto should be named CORECRYPTO_xxx
or CCxx_yyy and be defined to be either 0 or 1 in this file. You can add an
#ifndef #error construct at the end of this file to make sure it's always defined.
They should always be tested using the #if directive, never the #ifdef directive.
No other conditional macros shall ever be used (except in this file)
Configuration Macros that are defined outside of corecrypto (eg: KERNEL, DEBUG, ...)
shall only be used in this file to define CCxxx macros.
External macros should be assumed to be either undefined, defined with no value,
or defined as true or false. We shall strive to build with -Wundef whenever possible,
so the following construct should be used to test external macros in this file:
#if defined(DEBUG) && (DEBUG)
#define CORECRYPTO_DEBUG 1
#else
#define CORECRYPTO_DEBUG 0
#endif
It is acceptable to define a conditional CC_xxxx macro in an implementation file,
to be used only in this file.
The current code is not guaranteed to follow those rules, but should be fixed to.
Corecrypto requires GNU and C99 compatibility.
Typically enabled by passing --gnu --c99 to the compiler (eg. armcc)
*/

#if defined(DEBUG) && (DEBUG)
/* CC_DEBUG is already used in CommonCrypto */
#define CORECRYPTO_DEBUG 1
#else
#define CORECRYPTO_DEBUG 0
#endif

#if defined(KERNEL) && (KERNEL)
#define CC_KERNEL 1
#else
#define CC_KERNEL 0
#endif

#if defined(USE_L4) && (USE_L4)
#define CC_USE_L4 1
#else
#define CC_USE_L4 0
#endif

#if defined(MAVERICK) && (MAVERICK)
#define CC_MAVERICK 1
#else
#define CC_MAVERICK 0
#endif

#if defined(IBOOT) && (IBOOT)
#define CC_IBOOT 1
#else
#define CC_IBOOT 0
#endif

// BB configuration
#if CC_MAVERICK

// -- ENDIANESS
#if defined(ENDIAN_LITTLE) || (defined(__arm__) && !defined(__BIG_ENDIAN))
#define __LITTLE_ENDIAN__
#elif !defined(ENDIAN_BIG) && !defined(__BIG_ENDIAN)
#error Baseband endianess not defined.
#endif
#define AESOPT_ENDIAN_NO_FILE

// -- Architecture
#define CCN_UNIT_SIZE 4 // 32 bits
#define aligned(x) aligned((x)>8?8:(x)) // Alignment on 8 bytes max
#define SAFE_IO // AES support for unaligned Input/Output

// -- External function
#define assert ASSERT // sanity

// -- Warnings
// Ignore irrelevant warnings after verification
// #1254-D: arithmetic on pointer to void or function type
// #186-D: pointless comparison of unsigned integer with zero
// #546-D: transfer of control bypasses initialization of
#if defined(__GNUC__)
// warning: pointer of type 'void *' used in arithmetic
#pragma GCC diagnostic ignored "-Wpointer-arith"
#endif // arm or gnuc

#endif // MAVERICK

#if !defined(CCN_UNIT_SIZE)
#if defined(__x86_64__)
#if defined(__arm64__) || defined(__x86_64__)
#define CCN_UNIT_SIZE 8
#elif defined(__arm__) || defined(__i386__)
#define CCN_UNIT_SIZE 4
Expand All @@ -19,10 +116,44 @@
#endif
#endif /* !defined(CCN_UNIT_SIZE) */

#if defined(__x86_64__) || defined(__i386__)
#define CCN_IOS 0
#define CCN_OSX 1
#endif

/* No dynamic linking allowed in L4, e.g. avoid nonlazy symbols */
/* For corecrypto kext, CC_STATIC should be 0 */
#if CC_USE_L4
#define CC_STATIC 1
#endif

#if defined(__x86_64__) || defined(__i386__)
/* L4 do not have bzero, neither does hexagon of ARMCC even with gnu compatibility mode */
#if CC_USE_L4 || defined(__CC_ARM) || defined(__hexagon__)
#define CC_HAS_BZERO 0
#else
#define CC_HAS_BZERO 1
#endif

#if defined(__CC_ARM) || defined(__hexagon__)
// ARMASM.exe does not to like the file syntax of the asm implementation

#define CCN_ADD_ASM 0
#define CCN_SUB_ASM 0
#define CCN_MUL_ASM 0
#define CCN_ADDMUL1_ASM 0
#define CCN_MUL1_ASM 0
#define CCN_CMP_ASM 0
#define CCN_ADD1_ASM 0
#define CCN_SUB1_ASM 0
#define CCN_N_ASM 0
#define CCN_SET_ASM 0
#define CCAES_ARM 0
#define CCAES_INTEL 0
#define CCN_USE_BUILTIN_CLZ 0
#define CCSHA1_VNG_INTEL 0
#define CCSHA2_VNG_INTEL 0

#elif defined(__x86_64__) || defined(__i386__)

/* These assembly routines only work for a single CCN_UNIT_SIZE. */
#if (defined(__x86_64__) && CCN_UNIT_SIZE == 8) || (defined(__i386__) && CCN_UNIT_SIZE == 4)
Expand All @@ -44,6 +175,7 @@
#define CCN_SET_ASM 0
#define CCAES_ARM 0
#define CCAES_INTEL 1
#define CCAES_MUX 0
#define CCN_USE_BUILTIN_CLZ 0
#define CCSHA1_VNG_INTEL 1
#define CCSHA2_VNG_INTEL 1
Expand All @@ -64,6 +196,7 @@
#define CCN_SET_ASM 0
#define CCAES_ARM 0
#define CCAES_INTEL 0
#define CCAES_MUX 0
#define CCN_USE_BUILTIN_CLZ 0
#define CCSHA1_VNG_INTEL 0
#define CCSHA2_VNG_INTEL 0
Expand All @@ -80,6 +213,12 @@
#ifdef __GNUC__
#define CC_NORETURN __attribute__((__noreturn__))
#define CC_NOTHROW __attribute__((__nothrow__))
// Transparent Union
#if defined(__CC_ARM) || defined(__hexagon__)
#define CC_NONNULL_TU(N)
#else
#define CC_NONNULL_TU(N) __attribute__((__nonnull__ N))
#endif
#define CC_NONNULL(N) __attribute__((__nonnull__ N))
#define CC_NONNULL1 __attribute__((__nonnull__(1)))
#define CC_NONNULL2 __attribute__((__nonnull__(2)))
Expand All @@ -97,6 +236,12 @@
#define CC_UNUSED __attribute__((unused))
#else /* !__GNUC__ */
/*! @parseOnly */
#define CC_UNUSED
/*! @parseOnly */
#define CC_NONNULL_TU(N)
/*! @parseOnly */
#define CC_NONNULL(N)
/*! @parseOnly */
#define CC_NORETURN
/*! @parseOnly */
#define CC_NOTHROW
Expand Down
Loading

0 comments on commit 0e29ffd

Please sign in to comment.