aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/include/ghostty/vt/sys.h
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/include/ghostty/vt/sys.h
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/include/ghostty/vt/sys.h')
-rw-r--r--vendor/libghostty-vt/include/ghostty/vt/sys.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/include/ghostty/vt/sys.h b/vendor/libghostty-vt/include/ghostty/vt/sys.h
index ae905969..c5e5903b 100644
--- a/vendor/libghostty-vt/include/ghostty/vt/sys.h
+++ b/vendor/libghostty-vt/include/ghostty/vt/sys.h
@@ -125,6 +125,24 @@ typedef bool (*GhosttySysDecodePngFn)(
GhosttySysImage* out);
/**
+ * Callback type for secure random bytes.
+ *
+ * Fills @p buf with @p len cryptographically secure random bytes. The
+ * library uses this for secrets, so it must be a real CSPRNG (getrandom,
+ * arc4random_buf, BCryptGenRandom, crypto.getRandomValues, ...); a
+ * predictable source is a security hole.
+ *
+ * @param userdata The userdata pointer set via GHOSTTY_SYS_OPT_USERDATA
+ * @param buf Buffer to fill
+ * @param len Number of bytes to fill
+ * @return true if the buffer was filled, false if no entropy is available
+ */
+typedef bool (*GhosttySysRandomSecureFn)(
+ void* userdata,
+ uint8_t* buf,
+ size_t len);
+
+/**
* System option identifiers for ghostty_sys_set().
*/
typedef enum GHOSTTY_ENUM_TYPED {
@@ -165,6 +183,21 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Input type: GhosttySysLogFn (function pointer, or NULL)
*/
GHOSTTY_SYS_OPT_LOG = 2,
+
+ /**
+ * Override the secure random source.
+ *
+ * By default the library draws secure random bytes from the
+ * platform (getrandom or arc4random_buf on POSIX, CNG on Windows).
+ * Targets without one, such as wasm32-freestanding, have no default
+ * and operations that need entropy fail with GHOSTTY_IO_ERROR until
+ * this is set. When set,
+ * it is used instead of the platform source on every target. When
+ * cleared (NULL value), the platform default is restored.
+ *
+ * Input type: GhosttySysRandomSecureFn (function pointer, or NULL)
+ */
+ GHOSTTY_SYS_OPT_RANDOM_SECURE = 3,
GHOSTTY_SYS_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttySysOption;