CCCryptorReset_internal.h   [plain text]


/*
 * Copyright (c) 2012 Apple Inc. All Rights Reserved.
 *
 * @APPLE_LICENSE_HEADER_START@
 *
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Apple Public Source License
 * Version 2.0 (the 'License'). You may not use this file except in
 * compliance with the License. Please obtain a copy of the License at
 * http://www.opensource.apple.com/apsl/ and read it before using this
 * file.
 *
 * The Original Code and all software distributed under the License are
 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
 * Please see the License for the specific language governing rights and
 * limitations under the License.
 *
 * @APPLE_LICENSE_HEADER_END@
 *  CCCryptorReset_internal.h
 */

#ifndef CCCryptorReset_internal_h
#define CCCryptorReset_internal_h

#include <os/variant_private.h>
#include <mach-o/dyld_priv.h>
#include <TargetConditionals.h>

// refer to TargetConditionals.h for the target macro hierarchy
#if   TARGET_OS_OSX
#define CC_DYLOAD_PROGRAM_SDK_VERSION       DYLD_MACOSX_VERSION_10_13
#elif TARGET_OS_IPHONE
#define CC_DYLOAD_PROGRAM_SDK_VERSION       DYLD_IOS_VERSION_11_0
#else
#error CC_DYLOAD_PROGRAM_SDK_VERSION undefined
#endif

#define ProgramLinkedOnOrAfter_macOS1013_iOS11()  (dyld_get_program_sdk_version() >= CC_DYLOAD_PROGRAM_SDK_VERSION)

/*!
    @function   CCCryptorReset_binary_compatibility
    @abstract   Reinitializes an existing CCCryptorRef with a (possibly)
                new initialization vector. The CCCryptorRef's key is
                unchanged. Preserves compatibility for SKDs prior to
                macOS 10.13, iOS 11, watchOS 4 and tvOS 11. It is used
                internally in CommonCrypto. See CCCryptorReset for more information.
 
    @result     The only possible error is kCCParamError.
 
*/
CCCryptorStatus CCCryptorReset_binary_compatibility(CCCryptorRef cryptorRef, const void *iv);
#endif /* CCCryptorReset_internal_h */