From 21064fef2e791092fb957475932cdd8bb28cbe8f Mon Sep 17 00:00:00 2001
From: Li
Date: Wed, 24 Jan 2024 12:03:51 +1300
Subject: [PATCH] Add functions relating to GC authenticcation
---
db/360/SceSblGcAuthMgr.yml | 11 +++++++
docs/definitions.dox | 3 ++
include/psp2kern/kernel/gcauthmgr.h | 13 ++++++++
include/psp2kern/kernel/gcauthmgr/drm_bb.h | 35 +++++++++++++++++++++
include/psp2kern/kernel/gcauthmgr/gc_auth.h | 28 +++++++++++++++++
include/vitasdkkern.h | 1 +
6 files changed, 91 insertions(+)
create mode 100644 include/psp2kern/kernel/gcauthmgr.h
create mode 100644 include/psp2kern/kernel/gcauthmgr/drm_bb.h
create mode 100644 include/psp2kern/kernel/gcauthmgr/gc_auth.h
diff --git a/db/360/SceSblGcAuthMgr.yml b/db/360/SceSblGcAuthMgr.yml
index afcb779d01..cbd054e756 100644
--- a/db/360/SceSblGcAuthMgr.yml
+++ b/db/360/SceSblGcAuthMgr.yml
@@ -4,6 +4,17 @@ modules:
SceSblGcAuthMgr:
nid: 0xDB1A9016
libraries:
+ SceSblGcAuthMgrDrmBBForDriver:
+ nid: 0x1926B182
+ kernel: true
+ functions:
+ ksceSblGcAuthMgrDrmBBClearCartSecret: 0xBB451E83
+ ksceSblGcAuthMgrDrmBBGetCartSecret: 0xBB70DDC0
+ SceSblGcAuthMgrGcAuthForDriver:
+ nid: 0xC6627F5E
+ kernel: true
+ functions:
+ ksceSblGcAuthMgrGcAuthCartAuthentication: 0x68781760
SceSblGcAuthMgr:
kernel: false
nid: 0x7B13BCF7
diff --git a/docs/definitions.dox b/docs/definitions.dox
index 7ea65b17d7..76b70694d3 100644
--- a/docs/definitions.dox
+++ b/docs/definitions.dox
@@ -265,6 +265,9 @@
*
* \defgroup SceSblSsComm SM Loader
* Interface for sm loading/CallFunc
+ *
+ * \defgroup SceSblGcAuthMgr game cart Authentication Manager
+ * Interface for authentication with game carts
* \}
*
* \defgroup update Update
diff --git a/include/psp2kern/kernel/gcauthmgr.h b/include/psp2kern/kernel/gcauthmgr.h
new file mode 100644
index 0000000000..dcbf07804f
--- /dev/null
+++ b/include/psp2kern/kernel/gcauthmgr.h
@@ -0,0 +1,13 @@
+/**
+ * \kernelgroup{SceSblGcAuthMgr}
+ * \usage{psp2kern/kernel/gcauthmgr.h}
+ */
+
+
+#ifndef _PSP2KERN_KERNEL_GCAUTHMGR_H_
+#define _PSP2KERN_KERNEL_GCAUTHMGR_H_
+
+#include
+#include
+
+#endif /* _PSP2KERN_KERNEL_GCAUTHMGR_H_ */
diff --git a/include/psp2kern/kernel/gcauthmgr/drm_bb.h b/include/psp2kern/kernel/gcauthmgr/drm_bb.h
new file mode 100644
index 0000000000..2b723aeadb
--- /dev/null
+++ b/include/psp2kern/kernel/gcauthmgr/drm_bb.h
@@ -0,0 +1,35 @@
+/**
+ * \kernelgroup{SceSblGcAuthMgr}
+ * \usage{psp2kern/kernel/gcauthmgr/drm_bb.h,SceSblGcAuthMgrDrmBBForDriver_stub}
+ */
+
+#ifndef __PSP2KERN_GCAUTHMGR_DRM_BB_H__
+#define __PSP2KERN_GCAUTHMGR_DRM_BB_H__
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Removes derived cart secret from memory.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int ksceSblGcAuthMgrDrmBBClearCartSecret(void);
+
+/**
+ * @brief Gets derived cart secret from memory.
+ *
+ * @param[in] secret - Pointer to 0x20 bytes.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int ksceSblGcAuthMgrDrmBBGetCartSecret(void* secret);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PSP2KERN_GCAUTHMGR_DRM_BB_H__ */
\ No newline at end of file
diff --git a/include/psp2kern/kernel/gcauthmgr/gc_auth.h b/include/psp2kern/kernel/gcauthmgr/gc_auth.h
new file mode 100644
index 0000000000..46faf6d2e9
--- /dev/null
+++ b/include/psp2kern/kernel/gcauthmgr/gc_auth.h
@@ -0,0 +1,28 @@
+/**
+ * \kernelgroup{SceSblGcAuthMgr}
+ * \usage{psp2kern/kernel/gcauthmgr/gc_auth.h,SceSblGcAuthMgrGcAuthForDriver_stub}
+ */
+
+#ifndef __PSP2KERN_GCAUTHMGR_GC_AUTH_H__
+#define __PSP2KERN_GCAUTHMGR_GC_AUTH_H__
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Runs gamecart authentication
+ *
+ * @param[in] key_id - Not used for anything but must be < 0x10000.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+int ksceSblGcAuthMgrGcAuthCartAuthentication(SceUInt32 key_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PSP2KERN_GCAUTHMGR_GC_AUTH_H__ */
\ No newline at end of file
diff --git a/include/vitasdkkern.h b/include/vitasdkkern.h
index e45c5b0a3d..f4b306bad4 100644
--- a/include/vitasdkkern.h
+++ b/include/vitasdkkern.h
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include