1*33de042dSApple OSS Distributions #include <libkern/libkern.h> 2*33de042dSApple OSS Distributions #include <libkern/section_keywords.h> 3*33de042dSApple OSS Distributions #include <libkern/apple_encrypted_archive/apple_encrypted_archive.h> 4*33de042dSApple OSS Distributions 5*33de042dSApple OSS Distributions #if defined(SECURITY_READ_ONLY_LATE) 6*33de042dSApple OSS Distributions SECURITY_READ_ONLY_LATE(const apple_encrypted_archive_t *) apple_encrypted_archive = NULL; 7*33de042dSApple OSS Distributions SECURITY_READ_ONLY_LATE(registration_callback_t) registration_callback = NULL; 8*33de042dSApple OSS Distributions #else 9*33de042dSApple OSS Distributions const apple_encrypted_archive_t *apple_encrypted_archive = NULL; 10*33de042dSApple OSS Distributions registration_callback_t registration_callback = NULL; 11*33de042dSApple OSS Distributions #endif 12*33de042dSApple OSS Distributions 13*33de042dSApple OSS Distributions void apple_encrypted_archive_interface_register(const apple_encrypted_archive_t * aea)14*33de042dSApple OSS Distributionsapple_encrypted_archive_interface_register(const apple_encrypted_archive_t *aea) 15*33de042dSApple OSS Distributions { 16*33de042dSApple OSS Distributions if (apple_encrypted_archive) { 17*33de042dSApple OSS Distributions panic("apple_encrypted_archive interface already set"); 18*33de042dSApple OSS Distributions } 19*33de042dSApple OSS Distributions 20*33de042dSApple OSS Distributions apple_encrypted_archive = aea; 21*33de042dSApple OSS Distributions 22*33de042dSApple OSS Distributions if (registration_callback) { 23*33de042dSApple OSS Distributions registration_callback(); 24*33de042dSApple OSS Distributions } 25*33de042dSApple OSS Distributions } 26*33de042dSApple OSS Distributions 27*33de042dSApple OSS Distributions void apple_encrypted_archive_interface_set_registration_callback(registration_callback_t callback)28*33de042dSApple OSS Distributionsapple_encrypted_archive_interface_set_registration_callback(registration_callback_t callback) 29*33de042dSApple OSS Distributions { 30*33de042dSApple OSS Distributions if (callback && registration_callback) { 31*33de042dSApple OSS Distributions panic("apple_encrypted_archive interface registration callback is already set"); 32*33de042dSApple OSS Distributions } 33*33de042dSApple OSS Distributions 34*33de042dSApple OSS Distributions registration_callback = callback; 35*33de042dSApple OSS Distributions } 36