Skip to content

Commit 84ccb50

Browse files
committedApr 15, 2026
Add corecrypto from PureDarwin project
1 parent 28af818 commit 84ccb50

File tree

105 files changed

+14307
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+14307
-163
lines changed
 

‎Kernel/Extensions/AppleAHCIPort/AHCI.h‎

Lines changed: 0 additions & 161 deletions
This file was deleted.

‎Kernel/Extensions/AppleFileSystemDriver/AppleFileSystemDriver.cpp‎

Lines changed: 439 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3+
*
4+
* @APPLE_LICENSE_HEADER_START@
5+
*
6+
* This file contains Original Code and/or Modifications of Original Code
7+
* as defined in and that are subject to the Apple Public Source License
8+
* Version 2.0 (the 'License'). You may not use this file except in
9+
* compliance with the License. Please obtain a copy of the License at
10+
* http://www.opensource.apple.com/apsl/ and read it before using this
11+
* file.
12+
*
13+
* The Original Code and all software distributed under the License are
14+
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15+
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16+
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18+
* Please see the License for the specific language governing rights and
19+
* limitations under the License.
20+
*
21+
* @APPLE_LICENSE_HEADER_END@
22+
*/
23+
24+
#ifdef KERNEL
25+
#ifdef __cplusplus
26+
27+
#include <IOKit/IOService.h>
28+
#include <IOKit/storage/IOMedia.h>
29+
#include <uuid/uuid.h>
30+
31+
/*
32+
* Class
33+
*/
34+
35+
class AppleFileSystemDriver : public IOService
36+
{
37+
OSDeclareDefaultStructors(AppleFileSystemDriver)
38+
39+
protected:
40+
41+
IONotifier *_notifier;
42+
uuid_t _uuid;
43+
OSString *_uuidString;
44+
45+
struct ExpansionData { /* */ };
46+
ExpansionData * _expansionData;
47+
48+
public:
49+
50+
virtual bool start(IOService * provider);
51+
52+
virtual void free();
53+
54+
private:
55+
56+
static bool mediaNotificationHandler(void * target, void * ref,
57+
IOService * newService,
58+
IONotifier * notifier);
59+
60+
static IOReturn readHFSUUID(IOMedia *media, void **uuidPtr);
61+
62+
};
63+
64+
#endif /* KERNEL */
65+
#endif /* __cplusplus */
66+
Binary file not shown.

‎Kernel/Extensions/AppleFileSystemDriver/AppleFileSystemDriver.xcodeproj/project.pbxproj‎

Lines changed: 442 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
add_kext_bundle(AppleFileSystemDriver
2+
KERNEL_PRIVATE
3+
INFO_PLIST Info.plist
4+
BUNDLE_IDENTIFIER com.apple.driver.AppleFileSystemDriver
5+
BUNDLE_VERSION 1.0.0)
6+
7+
target_sources(AppleFileSystemDriver PRIVATE
8+
./AppleFileSystemDriver.cpp)
9+
10+
target_include_directories(AppleFileSystemDriver PRIVATE
11+
../../xnu/iokit
12+
../../xnu/osfmk
13+
../../xnu/bsd
14+
../../xnu/libkern
15+
${ROOT_BINARY_DIR}/Kernel/xnu/EXPORT_HDRS/osfmk
16+
${ROOT_BINARY_DIR}/Kernel/xnu/EXPORT_HDRS/
17+
../../xnu/EXTERNAL_HEADERS
18+
../IOStorageFamily
19+
${CMAKE_CURRENT_BINARY_DIR}
20+
${RAVYN_SDKROOT}/System/Library/Frameworks/System.framework/PrivateHeaders)
21+
22+
target_compile_options(AppleFileSystemDriver PRIVATE
23+
-mmacos-version-min=${MACOS_VERSION_MIN}
24+
-Wno-implicit-int-conversion -Wno-sign-conversion
25+
$<$<COMPILE_LANGUAGE:ASM>:-x assembler-with-cpp>)
26+
27+
target_link_options(AppleFileSystemDriver PRIVATE
28+
-mmacos-version-min=${MACOS_VERSION_MIN})
29+
30+
add_dependencies(AppleFileSystemDriver kextBuild)
31+
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../hfs/core/hfs_format.h
32+
${CMAKE_CURRENT_SOURCE_DIR}/../hfs/core/hfs_unistr.h
33+
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/hfs/)
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>AppleFileSystemDriver</string>
9+
<key>CFBundleName</key>
10+
<string>AppleFileSystemDriver</string>
11+
<key>CFBundleIconFile</key>
12+
<string></string>
13+
<key>CFBundleIdentifier</key>
14+
<string>com.apple.driver.AppleFileSystemDriver</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundlePackageType</key>
18+
<string>KEXT</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>3.0.1</string>
23+
<key>CFBundleShortVersionString</key>
24+
<string>3.0.1</string>
25+
<key>IOKitPersonalities</key>
26+
<dict>
27+
<key>AppleFileSystemDriver</key>
28+
<dict>
29+
<key>CFBundleIdentifier</key>
30+
<string>com.apple.driver.AppleFileSystemDriver</string>
31+
<key>IOClass</key>
32+
<string>AppleFileSystemDriver</string>
33+
<key>IOMatchCategory</key>
34+
<string>AppleFileSystemDriver</string>
35+
<key>IOProviderClass</key>
36+
<string>IOResources</string>
37+
<key>IOResourceMatch</key>
38+
<string>boot-uuid</string>
39+
<key>media-match</key>
40+
<dict>
41+
<key>IOPropertyMatch</key>
42+
<array>
43+
<dict>
44+
<key>Content Hint</key>
45+
<string>41504653-0000-11AA-AA11-00306543ECAC</string>
46+
<key>Leaf</key>
47+
<true/>
48+
</dict>
49+
<dict>
50+
<key>Content Hint</key>
51+
<string>48465300-0000-11AA-AA11-00306543ECAC</string>
52+
<key>Leaf</key>
53+
<true/>
54+
</dict>
55+
<dict>
56+
<key>Content Hint</key>
57+
<string>426F6F74-0000-11AA-AA11-00306543ECAC</string>
58+
<key>Leaf</key>
59+
<true/>
60+
</dict>
61+
<dict>
62+
<key>Content Hint</key>
63+
<string>Apple_HFS</string>
64+
<key>Leaf</key>
65+
<true/>
66+
</dict>
67+
<dict>
68+
<key>Content Hint</key>
69+
<string>Apple_HFSX</string>
70+
<key>Leaf</key>
71+
<true/>
72+
</dict>
73+
<dict>
74+
<key>Content Hint</key>
75+
<string>Apple_Boot</string>
76+
<key>Leaf</key>
77+
<true/>
78+
</dict>
79+
<dict>
80+
<key>Content Hint</key>
81+
<string>5265636F-7665-11AA-AA11-00306543ECAC</string>
82+
<key>Leaf</key>
83+
<true/>
84+
</dict>
85+
<dict>
86+
<key>Content Hint</key>
87+
<string>Apple_Recovery</string>
88+
<key>Leaf</key>
89+
<true/>
90+
</dict>
91+
</array>
92+
</dict>
93+
</dict>
94+
</dict>
95+
<key>OSBundleRequired</key>
96+
<string>Local-Root</string>
97+
<key>OSBundleLibraries</key>
98+
<dict>
99+
<key>com.apple.kpi.libkern</key>
100+
<string>10.0.0d1</string>
101+
<key>com.apple.kpi.iokit</key>
102+
<string>10.0.0d1</string>
103+
<key>com.apple.iokit.IOStorageFamily</key>
104+
<string>1.6</string>
105+
</dict>
106+
</dict>
107+
</plist>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
BUILD_VARIANTS[sdk=macosx*] = normal kasan
2+
BUILD_VARIANTS[sdk=iphoneos*] = normal kasan
3+
CODE_SIGN_IDENTITY = -
4+
OTHER_CFLAGS_kasan = $(KASAN_DEFAULT_CFLAGS)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* setbootuuid.c
3+
* AppleFileSystemDriver
4+
*
5+
* Created by Shantonu Sen on 9/14/07.
6+
* Copyright 2007 Apple Inc. All rights reserved.
7+
*
8+
*/
9+
10+
#include <stdio.h>
11+
#include <stdarg.h>
12+
#include <stdlib.h>
13+
#include <IOKit/IOKitLib.h>
14+
#include <CoreFoundation/CoreFoundation.h>
15+
#include <mach/mach_error.h>
16+
#include <err.h>
17+
18+
void usage(void);
19+
20+
int main(int argc, char *argv[]) {
21+
22+
CFStringRef uuidstr;
23+
CFUUIDRef uuid;
24+
io_service_t ioresources = IO_OBJECT_NULL;
25+
kern_return_t kret;
26+
27+
if (argc != 2) {
28+
usage();
29+
}
30+
31+
uuidstr = CFStringCreateWithCString(kCFAllocatorDefault, argv[1], kCFStringEncodingUTF8);
32+
uuid = CFUUIDCreateFromString(kCFAllocatorDefault, uuidstr);
33+
if (!uuid) {
34+
errx(1, "Invalid UUID string %s", argv[1]);
35+
}
36+
37+
CFRelease(uuid);
38+
39+
ioresources = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(kIOResourcesClass));
40+
if (ioresources == IO_OBJECT_NULL) {
41+
errx(1, "Can't find IOResources");
42+
}
43+
44+
kret = IORegistryEntrySetCFProperty(ioresources, CFSTR("boot-uuid"), uuidstr);
45+
if (kret) {
46+
errx(1, "Can't set boot-uuid: %d %s", kret, mach_error_string(kret));
47+
}
48+
49+
IOObjectRelease(ioresources);
50+
51+
CFRelease(uuidstr);
52+
53+
return 0;
54+
}
55+
56+
void usage(void)
57+
{
58+
fprintf(stderr, "Usage: %s 92DEB3E6-96DE-44CD-BE4F-152A4A4A2365\n", getprogname());
59+
exit(1);
60+
}

‎Kernel/Extensions/CMakeLists.txt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ add_custom_target(kextBuild)
2020
add_dependencies(kextBuild xnu libkmod)
2121

2222
add_subdirectory(AppleAPIC)
23-
#add_subdirectory(ApplePS2Controller)
2423
add_subdirectory(IOACPIFamily)
2524
add_subdirectory(IOPCIFamily)
2625
add_subdirectory(IOStorageFamily)
@@ -31,5 +30,5 @@ add_subdirectory(hfs)
3130
add_subdirectory(AppleFileSystemDriver)
3231
add_subdirectory(RavynAHCIPort)
3332
add_subdirectory(IOGraphics)
34-
#add_subdirectory(corecrypto)
33+
add_subdirectory(corecrypto)
3534
add_subdirectory(pthread)

0 commit comments

Comments
 (0)
Please sign in to comment.