X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5c19dc3ae3bd8e40a9c028b0deddd50ff337692c..641423b6670d8656d5daeaf988e7d307fb6c1ebc:/OSX/libsecurity_utilities/lib/debugging_internal.cpp diff --git a/OSX/libsecurity_utilities/lib/debugging_internal.cpp b/OSX/libsecurity_utilities/lib/debugging_internal.cpp index 83d2624c..53aeecd7 100644 --- a/OSX/libsecurity_utilities/lib/debugging_internal.cpp +++ b/OSX/libsecurity_utilities/lib/debugging_internal.cpp @@ -45,3 +45,23 @@ void secdebug_internal(const char* scope, const char* format, ...) va_end(list); } } + +void secdebugfunc_internal(const char* scope, const char* functionname, const char* format, ...) +{ + if (__builtin_expect(SECURITY_DEBUG_LOG_ENABLED(), 0)) + { + va_list list; + va_start(list, format); + + CFStringRef formatString = CFStringCreateWithFormat(kCFAllocatorDefault, NULL, CFSTR("%s: %s"), functionname, format); + CFStringRef message = CFStringCreateWithFormatAndArguments(kCFAllocatorDefault, NULL, formatString, list); + CFRelease(formatString); + CFIndex maxLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(message), kCFStringEncodingUTF8) + 1; + char buffer[maxLength]; + CFStringGetCString(message, buffer, sizeof(buffer), kCFStringEncodingUTF8); + CFRelease(message); + SECURITY_DEBUG_LOG((char *)(scope), (buffer)); + + va_end(list); + } +}