diff --git a/core/includes/lock.inc b/core/includes/lock.inc
index 7dd8db3..c5f23c2 100644
--- a/core/includes/lock.inc
+++ b/core/includes/lock.inc
@@ -94,7 +94,7 @@ function _lock_id() {
  * @param $name
  *   The name of the lock.
  * @param $timeout
- *   A number of seconds (float) before the lock expires (minimum of 0.001).
+ *   A number of seconds (float) before the lock expires.
  *
  * @return
  *   TRUE if the lock was acquired, FALSE if it failed.
@@ -102,8 +102,6 @@ function _lock_id() {
 function lock_acquire($name, $timeout = 30.0) {
   global $locks;
 
-  // Insure that the timeout is at least 1 ms.
-  $timeout = max($timeout, 0.001);
   $expire = microtime(TRUE) + $timeout;
   if (isset($locks[$name])) {
     // Try to extend the expiration of a lock we already acquired.
@@ -172,12 +170,14 @@ function lock_may_be_available($name) {
   $now = microtime(TRUE);
   if ($now > $expire) {
     // We check two conditions to prevent a race condition where another
-    // request acquired the lock and set a new expire time. We add a small
-    // number to $expire to avoid errors with float to string conversion.
+    // request acquired the lock and set a new expire time. Note that due to
+    // floating point precision errors, the two conditions may not be consistent
+    // within milliseconds of the timeout, but this will correct itself in the
+    // following call to this function.
     return (bool) db_delete('semaphore')
       ->condition('name', $name)
       ->condition('value', $lock['value'])
-      ->condition('expire', 0.0001 + $expire, '<=')
+      ->condition('expire', $now, '<=')
       ->execute();
   }
   return FALSE;
diff --git a/core/modules/openid/openid.inc b/core/modules/openid/openid.inc
index 6945f34..f6de843 100644
--- a/core/modules/openid/openid.inc
+++ b/core/modules/openid/openid.inc
@@ -25,11 +25,6 @@ define('OPENID_DH_DEFAULT_MOD', '155172898181473697471232257763715539915724801'
 define('OPENID_DH_DEFAULT_GEN', '2');
 
 /**
- * SHA-1 hash block size; used for Diffie-Hellman key exchange computations.
- */
-define('OPENID_SHA1_BLOCKSIZE', 64);
-
-/**
  * Random number generator; used for Diffie-Hellman key exchange computations.
  */
 define('OPENID_RAND_SOURCE', '/dev/urandom');
@@ -414,25 +409,11 @@ function _openid_signature($association, $message_array, $keys_to_sign) {
 
   $message = _openid_create_message($sign_data);
   $secret = base64_decode($association->mac_key);
-  $signature = _openid_hmac($secret, $message);
+  $signature = hash_hmac('sha1', $message, $secret, TRUE);
 
   return base64_encode($signature);
 }
 
-function _openid_hmac($key, $text) {
-  if (strlen($key) > OPENID_SHA1_BLOCKSIZE) {
-    $key = sha1($key, TRUE);
-  }
-
-  $key = str_pad($key, OPENID_SHA1_BLOCKSIZE, chr(0x00));
-  $ipad = str_repeat(chr(0x36), OPENID_SHA1_BLOCKSIZE);
-  $opad = str_repeat(chr(0x5c), OPENID_SHA1_BLOCKSIZE);
-  $hash1 = sha1(($key ^ $ipad) . $text, TRUE);
-  $hmac = sha1(($key ^ $opad) . $hash1, TRUE);
-
-  return $hmac;
-}
-
 function _openid_dh_base64_to_long($str) {
   $b64 = base64_decode($str);
 
