#ifndef CCGLOBALS_H
#define CCGLOBALS_H
#include <asl.h>
#include <corecrypto/ccdh.h>
#include <dispatch/dispatch.h>
#include <mach/mach_time.h>
#include "CommonCryptorPriv.h"
#include "CommonRandomPriv.h"
#include "basexx.h"
#include "crc.h"
#include "CommonCRC.h"
#if __has_include(<os/alloc_once_private.h>)
#include <os/alloc_once_private.h>
#if defined(OS_ALLOC_ONCE_KEY_LIBCOMMONCRYPTO) && !defined(KERNEL)
#define _LIBCOMMONCRYPTO_HAS_ALLOC_ONCE 1
#endif
#endif
#define CN_SUPPORTED_CRCS kCN_CRC_64_ECMA_182+1
#define CN_STANDARD_BASE_ENCODERS kCNEncodingBase16+1
struct cc_globals_s {
dispatch_once_t crc_init;
crcInfo crcSelectionTab[CN_SUPPORTED_CRCS];
dispatch_once_t basexx_init;
BaseEncoderFrame encoderTab[CN_STANDARD_BASE_ENCODERS];
dispatch_once_t digest_info_init;
const struct ccdigest_info **digest_info;
dispatch_once_t dev_random_init;
dispatch_once_t drbg_init;
ccInternalRandom dev_random;
ccInternalRandom drbg;
mach_timebase_info_data_t timebaseInfo;
dispatch_once_t debug_init;
aslclient aslhandle;
aslmsg msgptr;
cipherMode cipherModeTab[CC_SUPPORTED_CIPHERS][CC_DIRECTIONS];
};
typedef struct cc_globals_s *cc_globals_t;
__attribute__((__pure__))
static inline cc_globals_t
_cc_globals(void) {
#if _LIBCOMMONCRYPTO_HAS_ALLOC_ONCE
return (cc_globals_t) os_alloc_once(OS_ALLOC_ONCE_KEY_LIBCOMMONCRYPTO,
sizeof(struct cc_globals_s),
NULL);
#else
static struct cc_globals_s storage;
return &storage;
#endif
}
#endif