[Gambas-bugtracker] Bug #1725: gb.openssl Component HMac Function is Broken
bugtracker at gambaswiki.org
bugtracker at gambaswiki.org
Tue Feb 4 22:14:58 CET 2020
http://gambaswiki.org/bugtracker/edit?object=BUG.1725&from=L21haW4-
Andrew REALITYRIPPLE reported a new bug.
Summary
-------
gb.openssl Component HMac Function is Broken
Type : Bug
Priority : High
Gambas version : 3.14
Product : Unknown
Description
-----------
The HMac function in gb.openssl is completely broken in 3.14; the return value is being lost somewhere along the line. Tested on 3.14.2 locally and through the Playground. Instead of returning the HMac result, it simply returns the same return value as the previous component. Take, for example, the following code:
Use "gb.openssl"
Use "gb.mime"
Mime.Encode("Hello World", 4)
Dim sKey as String = "1234"
Dim sData as String = "Test"
Dim sAlg as String = "SHA1"
Print HMac(sKey, sData, sAlg)
Rather than printing out the HMAC-SHA-1 hash of "Test" using the password "1234", Gambas prints the value "SGVsbG8gV29y", which is the result of base64 encoding "Hello World" from line 3. Even a simple request like setting a variable to a class from a component will result in the HMac function returning that class. It sounds like some shared component return variable is not being correctly set by the HMac function, so it's just using whatever was last set.
System information
------------------
Irrelevant; Gambas Playground
More information about the Bugtracker
mailing list