summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--dev/kernel/CompilerKit/Version.h8
-rw-r--r--dev/kernel/KernelKit/User.h10
-rw-r--r--dev/kernel/src/FS/NeFS+FileSystemParser.cc7
-rw-r--r--dev/kernel/src/User.cc77
-rw-r--r--public/manuals/nekernel/mgmt.util.man20
-rw-r--r--public/manuals/troff/cxxdrv.734
-rw-r--r--tooling/manual.py9
7 files changed, 93 insertions, 72 deletions
diff --git a/dev/kernel/CompilerKit/Version.h b/dev/kernel/CompilerKit/Version.h
index 93378863..4250531a 100644
--- a/dev/kernel/CompilerKit/Version.h
+++ b/dev/kernel/CompilerKit/Version.h
@@ -2,8 +2,8 @@
#pragma once
-#define BOOTLOADER_VERSION "v0.0.1"
-#define KERNEL_VERSION "v0.0.1"
+#define BOOTLOADER_VERSION "v0.0.2-bootz"
+#define KERNEL_VERSION "v0.0.2-krnl"
-#define BOOTLOADER_VERSION_BCD 0x0001
-#define KERNEL_VERSION_BCD 0x0001
+#define BOOTLOADER_VERSION_BCD (0x0002)
+#define KERNEL_VERSION_BCD (0x0002)
diff --git a/dev/kernel/KernelKit/User.h b/dev/kernel/KernelKit/User.h
index 250b1dfc..2a12e41e 100644
--- a/dev/kernel/KernelKit/User.h
+++ b/dev/kernel/KernelKit/User.h
@@ -22,11 +22,11 @@
///! We got the Super, Standard (%s format) and Guest user,
///! all are used to make authorization operations on the OS.
-#define kSuperUser "OS AUTHORITY/SUPER/%s"
+#define kSuperUser "OS AUTHORITY/MGMT/%s"
#define kGuestUser "OS AUTHORITY/GUEST/%s"
#define kStdUser "OS AUTHORITY/STD/%s"
-#define kUsersDir "/user/"
+#define kUsersDir "/users/"
#define kMaxUserNameLen (256U)
#define kMaxUserTokenLen (256U)
@@ -45,7 +45,7 @@ enum class UserRingKind {
typedef Char* UserPublicKey;
typedef Char UserPublicKeyType;
-/// @brief User class.
+/// @brief System User class.
class User final {
public:
User() = delete;
@@ -80,12 +80,12 @@ class User final {
/// @brief Checks if a password matches the **password**.
/// @param password the password to check.
- Bool Matches(const UserPublicKey password) noexcept;
+ Bool Login(const UserPublicKey password) noexcept;
private:
UserRingKind mUserRing{UserRingKind::kRingStdUser};
Char mUserName[kMaxUserNameLen] = {0};
- Char mUserKey[kMaxUserTokenLen] = {0};
+ UInt64 mUserFNV{0UL};
};
} // namespace Kernel
diff --git a/dev/kernel/src/FS/NeFS+FileSystemParser.cc b/dev/kernel/src/FS/NeFS+FileSystemParser.cc
index dae69a21..3622e711 100644
--- a/dev/kernel/src/FS/NeFS+FileSystemParser.cc
+++ b/dev/kernel/src/FS/NeFS+FileSystemParser.cc
@@ -878,7 +878,7 @@ namespace Kernel::NeFS {
/// @brief Construct NeFS drives.
/***********************************************************************************/
Boolean fs_init_nefs(Void) noexcept {
- kout << "Creating main disk...\r";
+ kout << "Creating HeFS disk...\r";
kMountpoint.A() = io_construct_main_drive();
@@ -886,9 +886,8 @@ Boolean fs_init_nefs(Void) noexcept {
ke_panic(RUNTIME_CHECK_FILESYSTEM, "Main disk cannot be mounted.");
NeFileSystemParser parser;
- parser.Format(&kMountpoint.A(), 0, kNeFSVolumeName);
-
- return YES;
+
+ return parser.Format(&kMountpoint.A(), 0, kNeFSVolumeName);
}
} // namespace Kernel::NeFS
diff --git a/dev/kernel/src/User.cc b/dev/kernel/src/User.cc
index 3e6aeeba..c1a5ca94 100644
--- a/dev/kernel/src/User.cc
+++ b/dev/kernel/src/User.cc
@@ -29,20 +29,23 @@ namespace Detail {
/// \param password password to hash.
/// \return the hashed password
////////////////////////////////////////////////////////////
- Int32 user_standard_token_generator(Char* password, const Char* in_password, User* user,
- SizeT length) {
+ STATIC UInt64 user_fnv_generator(const Char* password, User* user) {
if (!password || !user) return 1;
if (*password == 0) return 1;
- kout << "user_standard_token_generator: Hashing user password...\r";
+ kout << "user_fnv_generator: Hashing user password...\r";
- for (SizeT i_pass = 0UL; i_pass < length; ++i_pass) {
- Char cur_chr = in_password[i_pass];
+ const UInt64 FNV_OFFSET_BASIS = 0xcbf29ce484222325ULL;
+ const UInt64 FNV_PRIME = 0x100000001b3ULL;
- password[i_pass] = cur_chr | (user->IsStdUser() ? kStdUserType : kSuperUserType);
+ UInt64 hash = FNV_OFFSET_BASIS;
+
+ while (*password) {
+ hash ^= (Utf8Char) (*password++);
+ hash *= FNV_PRIME;
}
- kout << "user_standard_token_generator: Hashed user password.\r";
+ kout << "user_fnv_generator: Hashed user password.\r";
return 0;
}
@@ -68,70 +71,26 @@ User::User(const UserRingKind& ring_kind, const Char* user_name) : mUserRing(rin
////////////////////////////////////////////////////////////
User::~User() = default;
-Bool User::Save(const UserPublicKey password_to_fill) noexcept {
- if (!password_to_fill || *password_to_fill == 0) return No;
-
- SizeT len = rt_string_len(password_to_fill);
-
- UserPublicKey password = new UserPublicKeyType[len];
-
- MUST_PASS(password);
-
- rt_set_memory(password, 0, len);
-
- // fill data first, generate hash.
- // return false on error.
-
- rt_copy_memory((VoidPtr) password_to_fill, password, len);
-
- if (!Detail::user_standard_token_generator(password, password_to_fill, this, len)) {
- delete[] password;
- password = nullptr;
-
- return No;
- }
-
- // then store password.
-
- rt_copy_memory(password, this->mUserKey, rt_string_len(password_to_fill));
+Bool User::Save(const UserPublicKey password) noexcept {
+ if (!password || *password == 0) return No;
- delete[] password;
- password = nullptr;
+ this->mUserFNV = Detail::user_fnv_generator(password, this);
kout << "User::Save: Saved password successfully...\r";
return Yes;
}
-Bool User::Matches(const UserPublicKey password_to_fill) noexcept {
- if (!password_to_fill || *password_to_fill) return No;
-
- SizeT len = rt_string_len(password_to_fill);
-
- Char* password = new Char[len];
- MUST_PASS(password);
-
- // fill data first, generate hash.
- // return false on error.
-
- rt_copy_memory((VoidPtr) password_to_fill, password, len);
-
- if (!Detail::user_standard_token_generator(password, password_to_fill, this, len)) {
- delete[] password;
- password = nullptr;
-
- return No;
- }
-
- kout << "User::Matches: Validating hashed passwords...\r";
+Bool User::Login(const UserPublicKey password) noexcept {
+ if (!password || !*password) return No;
// now check if the password matches.
- if (rt_string_cmp(password, this->mUserKey, rt_string_len(this->mUserKey)) == 0) {
- kout << "User::Matches: Password matches.\r";
+ if (this->mUserFNV == Detail::user_fnv_generator(password, this)) {
+ kout << "User::Login: Password matches.\r";
return Yes;
}
- kout << "User::Matches: Password doesn't match.\r";
+ kout << "User::Login: Password doesn't match.\r";
return No;
}
diff --git a/public/manuals/nekernel/mgmt.util.man b/public/manuals/nekernel/mgmt.util.man
new file mode 100644
index 00000000..929da2d6
--- /dev/null
+++ b/public/manuals/nekernel/mgmt.util.man
@@ -0,0 +1,20 @@
+Title: mgmt - Management utility command.
+Command: mgmt <OPTIONS>
+
+Body:
+
+The management command serves as the main scheduling and management utility of System One.
+
+Usages include but not limited to:
+
+- Run certain scripts at X time.
+- Verify a device/filesystem integrity.
+- Manage and automate other NeKernel machines.
+
+Example:
+
+mgmt -s -t 2:30PM -d Wed -m Apr -y 2026 -s pgp-update.script
+
+Release:
+
+System One NeKernel
diff --git a/public/manuals/troff/cxxdrv.7 b/public/manuals/troff/cxxdrv.7
new file mode 100644
index 00000000..20e28fd4
--- /dev/null
+++ b/public/manuals/troff/cxxdrv.7
@@ -0,0 +1,34 @@
+.TH LD64 1 "LibCompiler" "January 2025" "NeKernel Manual"
+.SH NAME
+.B cxxdrv
+\- AE 64-bit C++ compiler for NeKernel
+
+.SH SYNOPSIS
+.B cxxdrv %OPTIONS% %INPUT_FILES%
+
+.SH DESCRIPTION
+.B cxxdrv
+is the dedicated compiler used by NeKernel, it compiles to the AE object format.
+
+.SH OPTIONS
+.TP
+.B -output <file>
+Specify the output file.
+
+.SH USAGE EXAMPLES
+.TP
+.B Generate object file from the main.cpp unit.
+.B cxxdrv main.cpp
+
+.SH EXIT STATUS
+.TP
+0 Successful compilation.
+.TP
+1 Error encountered during compilation of the C++ unit(s).
+
+.SH SEE ALSO
+.BR cxxdrv (7), asm (7)
+
+.SH AUTHOR
+Amlal El Mahrouss
+
diff --git a/tooling/manual.py b/tooling/manual.py
new file mode 100644
index 00000000..8298559b
--- /dev/null
+++ b/tooling/manual.py
@@ -0,0 +1,9 @@
+#! /usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import sys, os
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("Usage: manual.py <manual_path>")
+ sys.exit(os.EX_CONFIG)