From d26a9c3c5819be48b76586c2fa60da9a7a9829dd Mon Sep 17 00:00:00 2001
From: Lukas Reschke
Date: Tue, 26 Aug 2014 19:02:40 +0200
Subject: [PATCH] Add some security utilities
This adds some security utilities to core including:
- A library for basic crypto operations (e.g. to encrypt passwords)
- A better library for cryptographic actions which allows you to specify the charset
- A library for secure string comparisions
Remove .htaccess
Remove .htaccess
Fix typo
Add public API
Use timing constant comparision
Remove CBC constant
Adjust code
Remove confusing $this
---
config/config.sample.php | 3 +
core/setup/controller.php | 1 -
core/templates/installation.php | 7 --
lib/private/repair.php | 1 +
lib/private/security/crypto.php | 104 ++++++++++++++++++++++++++
lib/private/security/securerandom.php | 79 +++++++++++++++++++
lib/private/security/stringutils.php | 38 ++++++++++
lib/private/server.php | 26 +++++++
lib/private/setup.php | 17 +++--
lib/private/util.php | 54 ++-----------
lib/public/security/icrypto.php | 46 ++++++++++++
lib/public/security/isecurerandom.php | 53 +++++++++++++
lib/public/security/stringutils.php | 25 +++++++
lib/public/util.php | 1 +
lib/repair/repairconfig.php | 37 +++++++++
tests/lib/security/crypto.php | 63 ++++++++++++++++
tests/lib/security/securerandom.php | 51 +++++++++++++
tests/lib/security/stringutils.php | 21 ++++++
18 files changed, 565 insertions(+), 62 deletions(-)
create mode 100644 lib/private/security/crypto.php
create mode 100644 lib/private/security/securerandom.php
create mode 100644 lib/private/security/stringutils.php
create mode 100644 lib/public/security/icrypto.php
create mode 100644 lib/public/security/isecurerandom.php
create mode 100644 lib/public/security/stringutils.php
create mode 100644 lib/repair/repairconfig.php
create mode 100644 tests/lib/security/crypto.php
create mode 100644 tests/lib/security/securerandom.php
create mode 100644 tests/lib/security/stringutils.php
diff --git a/config/config.sample.php b/config/config.sample.php
index 96565556910..02dbb1fcf75 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -35,6 +35,9 @@ $CONFIG = array(
/* Define the salt used to hash the user passwords. All your user passwords are lost if you lose this string. */
"passwordsalt" => "",
+/* Secret used by ownCloud for various purposes, e.g. to encrypt data. If you lose this string there will be data corruption. */
+"secret" => "",
+
/* Force use of HTTPS connection (true = use HTTPS) */
"forcessl" => false,
diff --git a/core/setup/controller.php b/core/setup/controller.php
index e764b232e89..c72f06fc2df 100644
--- a/core/setup/controller.php
+++ b/core/setup/controller.php
@@ -153,7 +153,6 @@ class Controller {
'hasMSSQL' => $hasMSSQL,
'databases' => $databases,
'directory' => $datadir,
- 'secureRNG' => \OC_Util::secureRNGAvailable(),
'htaccessWorking' => $htaccessWorking,
'vulnerableToNullByte' => $vulnerableToNullByte,
'errors' => $errors,
diff --git a/core/templates/installation.php b/core/templates/installation.php
index f934e3a86c2..b74d4caf107 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -27,13 +27,6 @@
t('Please update your PHP installation to use %s securely.', $theme->getName() )); ?>
-
-
-