Skip to content

Add php_hash_ops->is_crypto; disallow is_crypto=0 hashes in hash_hmac*(), hash_pbkdf2() #2312

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

Closed
wants to merge 1 commit into from

Conversation

narfbg
Copy link
Contributor

@narfbg narfbg commented Jan 16, 2017

This idea came from #1105, and replaces the temporary solution that was php_hash_is_crypt().

Obviously, it's a BC break compared to PHP 7.1 which allows checksum hashes to be used with hash_hmac(), hash_hmac_file(), hash_pbkdf2() ... should I write an RFC for that?

@@ -46,6 +46,7 @@ typedef struct _php_hash_ops {
int digest_size;
int block_size;
int context_size;
int is_crypto;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better: zend_bool

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe unsigned is_crypto : 1. Either is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the second, overwriting the old commit to keep it clean.

@nikic
Copy link
Member

nikic commented Jan 16, 2017

Imho no RFC is needed. These hashes don't make sense in hmac and can currently cause memory errors / segfaults, as we've seen in the fnv case.

@nikic
Copy link
Member

nikic commented Jan 18, 2017

Merged via d89d149. Thanks!

@narfbg
Copy link
Contributor Author

narfbg commented Jan 19, 2017

hash_init() was forgotten here :/ Another PR ...

@narfbg narfbg deleted the hash_crypto_flag branch January 19, 2017 11:58
php-pulls pushed a commit that referenced this pull request Jul 7, 2017
This was done back in January, but never noted in the NEWS file.
References:

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

Successfully merging this pull request may close these issues.

3 participants