Skip to content

Commit 94d3b45

Browse files
xnu-10063.101.15
Imported from xnu-10063.101.15.tar.gz
1 parent 1031c58 commit 94d3b45

File tree

1,021 files changed

+89042
-20775
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,021 files changed

+89042
-20775
lines changed

EXTERNAL_HEADERS/corecrypto/cc.h

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) (2010-2012,2014-2021) Apple Inc. All rights reserved.
1+
/* Copyright (c) (2010-2012,2014-2022) Apple Inc. All rights reserved.
22
*
33
* corecrypto is licensed under Apple Inc.’s Internal Use License Agreement (which
44
* is contained in the License.txt file distributed with corecrypto) and only to
@@ -19,6 +19,8 @@
1919
#include <string.h>
2020
#include <stdint.h>
2121
#include <stdbool.h>
22+
#include <stddef.h>
23+
#include <stdarg.h>
2224

2325
CC_PTRCHECK_CAPABLE_HEADER()
2426

@@ -82,13 +84,13 @@ __attribute__((availability(bridgeos,unavailable)))
8284
#include <assert.h>
8385
#endif
8486

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

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

182-
// cc_zero is deprecated, please use cc_clear instead.
183-
cc_deprecate_with_replacement("cc_clear", 13.0, 10.15, 13.0, 6.0, 4.0)
184-
CC_NONNULL_ALL CC_INLINE
185-
void cc_zero(size_t len, void *cc_sized_by(len) dst)
186-
{
187-
cc_clear(len, dst);
188-
}
189-
190184
#define cc_copy(_size_, _dst_, _src_) memcpy(_dst_, _src_, _size_)
191185

192-
CC_INLINE CC_NONNULL((2, 3, 4))
186+
CC_INLINE CC_NONNULL((2))
193187
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) {
194188
uint8_t *_r=(uint8_t *)r;
195189
const uint8_t *_s=(const uint8_t *)s;
@@ -242,4 +236,11 @@ int cc_cmp_safe (size_t num, const void * cc_sized_by(num) ptr1, const void * cc
242236
#define CC_SPTR(_sn_, _n_) _n_
243237
#endif
244238

239+
// Similar to the iovec type used in scatter-gather APIs like readv()
240+
// and writev().
241+
typedef struct cc_iovec {
242+
const void *base;
243+
size_t nbytes;
244+
} cc_iovec_t;
245+
245246
#endif /* _CORECRYPTO_CC_H_ */

0 commit comments

Comments
 (0)