]> git.saurik.com Git - apple/xnu.git/blame - EXTERNAL_HEADERS/corecrypto/cc_debug.h
xnu-3247.1.106.tar.gz
[apple/xnu.git] / EXTERNAL_HEADERS / corecrypto / cc_debug.h
CommitLineData
3e170ce0
A
1/*
2 * cc_debug.h
3 * corecrypto
4 *
5 * Created on 01/25/2012
6 *
7 * Copyright (c) 2012,2014,2015 Apple Inc. All rights reserved.
8 *
9 */
10
11//debug configuration header file
12#ifndef _CORECRYPTO_CCN_DEBUG_H_
13#define _CORECRYPTO_CCN_DEBUG_H_
14
15#include <corecrypto/cc_config.h>
16
17// DO NOT INCLUDE this HEADER file in CoreCrypto files added for XNU project or headers
18// included by external clients.
19
20// ========================
21// Printf for corecrypto
22// ========================
23#if CC_KERNEL
24#include <pexpert/pexpert.h>
25#define cc_printf(x...) printf(x)
26extern int printf(const char *format, ...) __printflike(1,2);
27#elif CC_USE_S3
28#define cc_printf(x...) printf(x)
29#else
30#include <stdio.h>
31#define cc_printf(x...) fprintf(stderr, x)
32#endif
33
34// ========================
35// Integer types
36// ========================
37
38#if CC_KERNEL
39/* Those are not defined in libkern */
40#define PRIx64 "llx"
41#define PRIx32 "x"
42#define PRIx16 "hx"
43#define PRIx8 "hhx"
44#else
45#include <inttypes.h>
46#endif
47
48#if CCN_UNIT_SIZE == 8
49#define CCPRIx_UNIT ".016" PRIx64
50#elif CCN_UNIT_SIZE == 4
51#define CCPRIx_UNIT ".08" PRIx32
52#elif CCN_UNIT_SIZE == 2
53#define CCPRIx_UNIT ".04" PRIx16
54#elif CCN_UNIT_SIZE == 1
55#define CCPRIx_UNIT ".02" PRIx8
56#else
57#error invalid CCN_UNIT_SIZE
58#endif
59
60// ========================
61// Print utilities for corecrypto
62// ========================
63/* Print a byte array of arbitrary size */
64void cc_print(const char *label, unsigned long count, const uint8_t *s);
65
66#endif /* _CORECRYPTO_CCN_DEBUG_H_ */