Skip to content

Commit

Permalink
xnu-10063.101.15
Browse files Browse the repository at this point in the history
Imported from xnu-10063.101.15.tar.gz
  • Loading branch information
AppleOSSDistributions committed Mar 26, 2024
1 parent 1031c58 commit 94d3b45
Show file tree
Hide file tree
Showing 1,021 changed files with 89,042 additions and 20,775 deletions.
33 changes: 17 additions & 16 deletions EXTERNAL_HEADERS/corecrypto/cc.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) (2010-2012,2014-2021) Apple Inc. All rights reserved.
/* Copyright (c) (2010-2012,2014-2022) 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
Expand All @@ -19,6 +19,8 @@
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdarg.h>

CC_PTRCHECK_CAPABLE_HEADER()

Expand Down Expand Up @@ -82,13 +84,13 @@ __attribute__((availability(bridgeos,unavailable)))
#include <assert.h>
#endif

/* Provide a static assert that can be used to create compile-type failures,
except on GCC which does not support the function when "e" comes from a
const value. */
#ifndef __GNUC__
#define cc_static_assert(e, m) enum { cc_concat(static_assert_, __COUNTER__) = 1 / (int)(!!(e)) }
/* Provide a static assert that can be used to create compile-type failures. */
#if __has_feature(c_static_assert) || __has_extension(c_static_assert)
#define cc_static_assert(e, m) _Static_assert(e, m)
#elif !defined(__GNUC__)
#define cc_static_assert(e, m) enum { cc_concat(static_assert_, __COUNTER__) = 1 / (int)(!!(e)) }
#else
#define cc_static_assert(e, m)
#define cc_static_assert(e, m)
#endif

/* Declare a struct element with a guarenteed alignment of _alignment_.
Expand Down Expand Up @@ -179,17 +181,9 @@ uint8_t b[_alignment_]; \
CC_NONNULL((2))
void cc_clear(size_t len, void *cc_sized_by(len) dst);

// cc_zero is deprecated, please use cc_clear instead.
cc_deprecate_with_replacement("cc_clear", 13.0, 10.15, 13.0, 6.0, 4.0)
CC_NONNULL_ALL CC_INLINE
void cc_zero(size_t len, void *cc_sized_by(len) dst)
{
cc_clear(len, dst);
}

#define cc_copy(_size_, _dst_, _src_) memcpy(_dst_, _src_, _size_)

CC_INLINE CC_NONNULL((2, 3, 4))
CC_INLINE CC_NONNULL((2))
void cc_xor(size_t size, void *cc_sized_by(size) r, const void *cc_sized_by(size) s, const void *cc_sized_by(size) t) {
uint8_t *_r=(uint8_t *)r;
const uint8_t *_s=(const uint8_t *)s;
Expand Down Expand Up @@ -242,4 +236,11 @@ int cc_cmp_safe (size_t num, const void * cc_sized_by(num) ptr1, const void * cc
#define CC_SPTR(_sn_, _n_) _n_
#endif

// Similar to the iovec type used in scatter-gather APIs like readv()
// and writev().
typedef struct cc_iovec {
const void *base;
size_t nbytes;
} cc_iovec_t;

#endif /* _CORECRYPTO_CC_H_ */
Loading

0 comments on commit 94d3b45

Please sign in to comment.