php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80236 How $tag works in openssl_encrypt() with GCM mode is unclear
Submitted: 2020-10-14 16:24 UTC Modified: -
From: adrian at proresult dot no Assigned:
Status: Open Package: OpenSSL related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: adrian at proresult dot no
New email:
PHP Version: OS:

 

 [2020-10-14 16:24 UTC] adrian at proresult dot no
Description:
------------
---
From manual page: https://php.net/function.openssl-encrypt
---
As the documentation stands today, I think it's unclear how $tag is set and how you're supposed to retrieve/use it. After searching through other online sources for a while, I figured out that $tag is automatically set when calling openssl_encrypt(). Once I know, it seems obvious (since it's passed by reference, the function can alter its value), but before I was spoon-fed this information elsewhere, I had a hard time understanding how $tag should be formed, how it is set, and how it can be retrieved by the programmer. I suggest making this clearer in the documentation to avoid future confusion for other developers new to the openssl_* functions.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-15 03:24 UTC] a at b dot c dot de
I agree that it could be clearer that those two variables are for values returned by the function. There is an example of their use further down, but as it is only a snippet one could easily think that maybe those variables were being set in earlier code not shown.

I've made a submission through the online editor edit.php.net that I think gives the right idea. I didn't go to too much detail about what the tag is or what it's for or how it's to be used because - this being crypto and therefore Not A Toy™ - specialised references would be a more appropriate source for the necessary background.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 18:01:23 2020 UTC