Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] bad $length #15

Closed
bilogic opened this issue Jul 29, 2024 · 3 comments
Closed

[BUG] bad $length #15

bilogic opened this issue Jul 29, 2024 · 3 comments

Comments

@bilogic
Copy link
Contributor

bilogic commented Jul 29, 2024

https://github.com/phpseclib/phpseclib/blob/44d5ca2ab572b047caf09bf7e2397a8fb6bf7b10/phpseclib/Crypt/Rijndael.php#L175-L180

public function setBlockLength($length)
{
$length >>= 5;
if ($length > 8) {
$length = 8;
} elseif ($length < 4) {
$length = 4;
}
$this->cipher->setBlockLength($length);
}

$length is shifted 5 bits by this repo, not what the actual phpseclib3 expects

@bilogic
Copy link
Contributor Author

bilogic commented Jul 30, 2024

$class = new \ReflectionClass(static::class);
$class = "phpseclib3\\Crypt\\" . $class->getShortName();
$this->cipher = new $class($map[$mode]);
$this->key_length = $this->cipher->getKeyLength();

I tried to workaround first but this hardcoded namespace complicates things, please kindly accept the PR #16 thanks

@terrafrost
Copy link
Member

I tried to workaround first but this hardcoded namespace complicates things, please kindly accept the PR #16 thanks

This has been merged.

That said, do understand that this is mainly a one man project, this isn't my full time job and I have other responsibilities above and beyond phpseclib so please keep that in mind when awaiting responses.

Anyway, thanks for the bug report / pull request!

@bilogic
Copy link
Contributor Author

bilogic commented Jul 31, 2024

Thanks! Yes, I'm aware there are no obligations, but as I could not find another work around, I decided to send the 2nd message. Appreciate the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants