#include <stdio.h>
#include <dlfcn.h>
int main() {
printf("[BEGIN] dlopen-signing\n");
void* handle = dlopen("signed.dylib", RTLD_LAZY);
if ( handle == NULL ) {
printf("dlerror(): %s\n", dlerror());
printf("[FAIL] dlopen-signing (signed loading signed)\n");
return 0;
} else {
int result = dlclose(handle);
if ( result != 0 ) {
printf("dlclose() returned %c\n", result);
printf("[FAIL] dlopen-signing (signed unloading signed)\n");
return 0;
}
}
handle = dlopen("unsigned.dylib", RTLD_LAZY);
if ( handle != NULL ) {
printf("dlerror(): %s\n", dlerror());
printf("[FAIL] dlopen-signing (signed loading unsigned)\n");
return 0;
} else {
int result = dlclose(handle);
if ( result != 0 ) {
printf("dlclose() returned %c\n", result);
printf("[FAIL] dlopen-signing (signed unloading signed)\n");
return 0;
}
}
printf("[PASS] dlopen-signing\n");
return 0;
}