- fix E_NOTICE notices

- renamed hmac() -> hash() in SSH2.php


git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@23 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2009-02-26 17:25:03 +00:00
parent a8e70cbaa5
commit 736bfab276
4 changed files with 11 additions and 10 deletions

View File

@ -56,7 +56,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVIII Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: AES.php,v 1.1 2009-02-16 23:11:01 terrafrost Exp $
* @version $Id: AES.php,v 1.2 2009-02-26 17:25:00 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -126,7 +126,7 @@ class Crypt_AES extends Crypt_Rijndael {
* @return Crypt_AES
* @access public
*/
function Crypt_AES($mode = CRYPT_MODE_AES_CBC)
function Crypt_AES($mode = CRYPT_AES_MODE_CBC)
{
if ( !defined('CRYPT_AES_MODE') ) {
switch (true) {

View File

@ -46,7 +46,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVII Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: Hash.php,v 1.1 2009-02-16 22:22:13 terrafrost Exp $
* @version $Id: Hash.php,v 1.2 2009-02-26 17:25:00 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -189,8 +189,8 @@ class Crypt_Hash {
$this->l = 20;
}
switch (CRYPT_HMAC_MODE) {
case CRYPT_HMAC_MODE_MHASH:
switch (CRYPT_HASH_MODE) {
case CRYPT_HASH_MODE_MHASH:
switch ($hash) {
case 'md5':
case 'md5-96':
@ -202,7 +202,7 @@ class Crypt_Hash {
$this->hash = MHASH_SHA1;
}
return;
case CRYPT_HMAC_MODE_HASH:
case CRYPT_HASH_MODE_HASH:
switch ($hash) {
case 'md5':
case 'md5-96':

View File

@ -69,7 +69,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVI Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: BigInteger.php,v 1.5 2009-02-16 23:11:01 terrafrost Exp $
* @version $Id: BigInteger.php,v 1.6 2009-02-26 17:25:03 terrafrost Exp $
* @link http://pear.php.net/package/Math_BigInteger
*/
@ -1952,6 +1952,7 @@ class Math_BigInteger {
$max = $max->subtract($min);
$max = ltrim($max->toBytes(), chr(0));
$size = strlen($max) - 1;
$random = '';
$bytes = $size & 3;
for ($i = 0; $i < $bytes; $i++) {

View File

@ -41,7 +41,7 @@
* @author Jim Wigginton <terrafrost@php.net>
* @copyright MMVII Jim Wigginton
* @license http://www.gnu.org/licenses/lgpl.txt
* @version $Id: SSH2.php,v 1.9 2009-02-16 22:22:13 terrafrost Exp $
* @version $Id: SSH2.php,v 1.10 2009-02-26 17:25:03 terrafrost Exp $
* @link http://phpseclib.sourceforge.net
*/
@ -1369,7 +1369,7 @@ class Net_SSH2 {
if ($this->hmac_check !== false) {
$hmac = fread($this->fsock, $this->hmac_size);
if ($hmac != $this->hmac_check->hmac(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) {
if ($hmac != $this->hmac_check->hash(pack('NNCa*', $this->get_seq_no, $packet_length, $padding_length, $payload . $padding))) {
user_error('Invalid HMAC', E_USER_NOTICE);
return false;
}
@ -1499,7 +1499,7 @@ class Net_SSH2 {
// we subtract 4 from packet_length because the packet_length field isn't supposed to include itself
$packet = pack('NCa*', $packet_length - 4, $padding_length, $data . $padding);
$hmac = $this->hmac_create !== false ? $this->hmac_create->hmac(pack('Na*', $this->send_seq_no, $packet)) : '';
$hmac = $this->hmac_create !== false ? $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)) : '';
$this->send_seq_no++;
if ($this->encrypt !== false) {