summaryrefslogtreecommitdiff
path: root/plugins/OStatus/lib/safecrypt_rsa.php
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/lib/safecrypt_rsa.php')
-rw-r--r--plugins/OStatus/lib/safecrypt_rsa.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/OStatus/lib/safecrypt_rsa.php b/plugins/OStatus/lib/safecrypt_rsa.php
new file mode 100644
index 000000000..f3aa2c928
--- /dev/null
+++ b/plugins/OStatus/lib/safecrypt_rsa.php
@@ -0,0 +1,18 @@
+<?php
+
+require_once 'Crypt/RSA.php';
+
+/**
+ * Crypt_RSA stores a Math_BigInteger with value 0, which triggers a bug
+ * in Math_BigInteger's wakeup function which spews notices to log or output.
+ * This wrapper replaces it with a version that survives serialization.
+ */
+class SafeCrypt_RSA extends Crypt_RSA
+{
+ function __construct()
+ {
+ parent::__construct();
+ $this->zero = new SafeMath_BigInteger();
+ }
+}
+