As a follow up of #302632: Use PHP5 functionality for _openid_sha1(). Here is a patch that tests if hash extension (Default in PHP5) is available and use hash_hmac() function in _openid_hmac().

See chx's comment for details on why we can't just rely on this extension being available:

#302632-8: Use PHP5 functionality for _openid_sha1()

Comments

recidive’s picture

Title: Use hash extension in _openid_hmac() is available » Use hash extension in _openid_hmac() if available

Typo in title.

cburschka’s picture

Status: Needs review » Needs work

This patch looks ready to go, except for one blank line containing two spaces.

recidive’s picture

Status: Needs work » Needs review
StatusFileSize
new1.28 KB

Ok, this time without the spaces.

dries’s picture

Personally, I'd not bother with having two code paths. This code shouldn't be in the critical performance path, so the existing code is probably fine. I'm tempted to mark this "won't fix".

dries’s picture

Status: Needs review » Closed (won't fix)

Marking this as "won't fix".

c960657’s picture

We now require the hash extension (see system_requirements()), so we can now switch completely to hash_hmac().

openid_hmac-A-2.patch removes _openid_hmac() and OPENID_SHA1_BLOCKSIZE completely, openid_hmac-B-2.patch preserves them for backwards-compatibility. It think we should use the former—_openid_hmac() is a private function, and I doubt anybody outside of the OpenID module would use the OPENID_SHA1_BLOCKSIZE constant.

Edit: The patches are attached to the next comment.

c960657’s picture

Title: Use hash extension in _openid_hmac() if available » Use hash extension in _openid_hmac()
Status: Closed (won't fix) » Needs review
StatusFileSize
new1.2 KB
new2.14 KB
recidive’s picture

I also think the "A" patch is better.

c960657’s picture

Version: 7.x-dev » 8.x-dev

For D8, openid_hmac-A-2.patch is definitely the right choice.

c960657’s picture

StatusFileSize
new1.4 KB
sun’s picture

Status: Needs review » Reviewed & tested by the community

Awesome.

catch’s picture

#10: openid_hmac-A-3.patch queued for re-testing.

sun’s picture

StatusFileSize
new1.39 KB

Re-rolled against HEAD.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Looks great. Committed/pushed to 8.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

c960657’s picture

Version: 8.x-dev » 7.x-dev
Status: Closed (fixed) » Needs review
StatusFileSize
new768 bytes

Reroll of openid_hmac-A-2.patch for D7.

  • catch committed 06373cf on 8.3.x
    Issue #448162 by c960657, recidive, sun: Use hash extension in...

  • catch committed 06373cf on 8.3.x
    Issue #448162 by c960657, recidive, sun: Use hash extension in...

  • catch committed 06373cf on 8.4.x
    Issue #448162 by c960657, recidive, sun: Use hash extension in...

  • catch committed 06373cf on 8.4.x
    Issue #448162 by c960657, recidive, sun: Use hash extension in...

  • catch committed 06373cf on 9.1.x
    Issue #448162 by c960657, recidive, sun: Use hash extension in...

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.