Hi Gert
thanks for your reply! At the current stage I think it fully suffices to do exactly what you did: Run the standard tests that come with OpenSSL, i.e. it isn't yet necessary to build a dedicated test case (which doesn't mean that this might not become necessary when digging deeper).
However, the output of your archlvl commands below already gives a nice indication on the behavior of OpenSSL: One sees that the cryptographic instructions are disabled: They hide behind facilities MSA_EXTENSION_n (n being 1 to 4) and MSG_SECURITY. That means, in your Hyperion configuration OpenSSL has to use "its own code" instead of the instructions, which explains why you don't see any errors.
If you like, you could now investigate why the cryptographic instructions are disabled on your system. This would require you to verify that the following #defines are in your feat900.h:
#define FEATURE_MESSAGE_SECURITY_ASSIST
#define FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_1
#define FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_2
#define FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_3
#define FEATURE_MESSAGE_SECURITY_ASSIST_EXTENSION_4
If they are not in feat900.h, put them in (double check they are not sitting inside some #ifdef sections that prevent them from getting executed) and rebuild Hercules.
Then ensure dyncrypt is loaded (issue an lsmod command to see all loaded modules), and, of course, ensure the above mentioned facilities are reported being enabled by archlvl query all. Once these conditions are met, I'd bet the OpenSSL tests will report the same errors you saw on Hercules 3.11/3.12 .
Cheers
JÃŒrgen
---In hercules-***@yahoogroups.com, <***@...> wrote :
Hello,
as I said previously I am not sure of the relevance of my tests as I just played around a bit without logically building a test case. However these are the settings of the commands as requested.
Maybe you just tell me what to test from scratch with which settings and which hercules versions so the conclusions are correct.
Archlvl
HHC01603I archlvl
HHC02203I archmode : z/Arch
archlvl query all
HHC00890I Facility(HFP_MULT_ADD_SUB ) Enabled +
HHC00890I Facility(EXTENDED_IMMED ) Enabled
HHC00890I Facility(TRAN_FAC3 ) Enabled
HHC00890I Facility(HFP_UNNORM_EXT ) Enabled
HHC00890I Facility(ETF2_ENHANCEMENT ) Enabled
HHC00890I Facility(STORE_CLOCK_FAST ) Enabled
HHC00890I Facility(PARSING_ENHANCE ) Enabled
HHC00890I Facility(MVCOS ) Enabled
HHC00890I Facility(TOD_CLOCK_STEER ) Enabled
HHC00890I Facility(ETF3_ENHANCEMENT ) Enabled
HHC00890I Facility(EXTRACT_CPU_TIME ) Enabled
HHC00890I Facility(CSSF ) Enabled
HHC00890I Facility(CSSF2 ) Enabled
HHC00890I Facility(GEN_INST_EXTN ) Enabled
HHC00890I Facility(EXECUTE_EXTN ) Enabled
HHC00890I Facility(ENH_MONITOR ) Disabled
HHC00890I Facility(LOAD_PROG_PARAM ) Disabled
HHC00890I Facility(FPS_ENHANCEMENT ) Enabled
HHC00890I Facility(DECIMAL_FLOAT ) Enabled
HHC00890I Facility(DFP_HPERF ) Enabled
HHC00890I Facility(FAST_BCR_SERIAL ) Disabled
HHC00890I Facility(CMPSC_ENH ) Disabled
HHC00890I Facility(RES_REF_BITS_MUL ) Disabled
HHC00890I Facility(ACC_EX_FS_INDIC ) Disabled
HHC00890I Facility(MSA_EXTENSION_3 ) Disabled
HHC00890I Facility(MSA_EXTENSION_4 ) Disabled
HHC00890I Facility(MOVE_INVERSE ) Enabled
HHC00890I Facility(MSA_EXTENSION_1 ) Disabled
HHC00890I Facility(MSA_EXTENSION_2 ) Disabled
HHC00890I Facility(PROBSTATE_DIAGF08 ) Disabled
HHC00890I Facility(SIGP_SETARCH_S370 ) Disabled
HHC00890I Facility(HOST_RESOURCE_ACCESS) Disabled
HHC00890I Facility(QEBSM ) Disabled
HHC00890I Facility(QDIO_THININT ) Disabled
HHC00890I Facility(QDIO_TDD ) Disabled
HHC00890I Facility(SVS ) Disabled
HHC00890I Facility(LOGICAL_PARTITION ) Enabled
HHC00890I Facility(VIRTUAL_MACHINE ) Disabled
HHC00890I Facility(QDIO_ASSIST ) Disabled
HHC00890I Facility(INTERVAL_TIMER ) Enabled
HHC00890I Facility(DETECT_PGMINTLOOP ) Enabled
On 2016-04-23 10:55, ***@... mailto:***@... [hercules-390] wrote:
Hi Gert
That's an interesting observation.
I currently don't know, under which conditions (if at all) OpenSSL uses the cryptographic instructions, as I never looked into this. If it behaves as a good citizen it issues the query function provided by each of the instructions during initialization and from then on uses the cryptographic instructions for the functions found to be available and its own code for those functions not being available. Clearly, one can assume that "its own code" will work correctly, or, at least, deliver the expected results when running the test suites. So, one reason for the behavior you are observing can be that OpenSSL doesn't use the defective instructions during your test run on Hyperion.
On the Spinhawk (Hercules 3.x) side of things the features activated in featxxx.h (xxx being the archmode) decide, which function codes will be reported available by the query functions, once dyncrypt is loaded.
On the Hyperion side in addition to the feature activation in featxxx.h there is the dynamic situation given by the archlvl command, with the initial defaults determined in archlvl.c. The dyncrypt module uses both: At compile time it honors the definitions given by featxxx.h and at run time it cross checks the settings given by archlvl.
So, it would be interesting to see the output of the following two commands when the system you are using for your tests is running on Hyperion:
archlvl (without arguments)
archlvl query all
In addition, it would be interesting to see the featxxx.h used for building the architecture shown by the first archlvl command.
Maybe we can draw some conclusions from this. On the other hand, the results from Paul's and your testings with my upcoming patch will probably bring more clarity. And, yes, if this still brings not the level of insight needed to understand what's going on, a close look into the OpenSSL source would also be indicated.
Cheers
JÃŒrgen
---In hercules-***@yahoogroups.com mailto:hercules-***@yahoogroups.com, <***@...> mailto:***@... wrote :
Hi,
Indeed a tough one it seems. Very impressive. From your part.
Furthermore I can report that:
Make test for openssl crashes hercules 3.07.
3.11 and 3.12 produce the error from Paul (ciphertext mismatch).
4.00 hyperion does not produce an error at all!This sounds very strange. Maybe I am doing something wrong?
Regards,
Gert
Verzonden van Yahoo Mail voor iPhone
Op donderdag, april 21, 2016, 10:40 PM, ***@... [hercules-390] <hercules-***@yahoogroups.com> mailto:hercules-***@yahoogroups.com schreef:
Hi Paul, Gert
Well, the below was once again too optimistic, it didn't stand my plausibility checks .
This forced me to dive in even deeper. In the meantime I know the "IEEE Standard for Cryptographic Protection of Data on Block-Oriented Storage Devices (1619-2007)" by heart, in fact I can sing to its lyrics. This stuff really has the potential to drive me insane...
Most annoyingly, it turned out that one of my very first tests after Paul reported the problem targeted the correct algorithm, but I made a mistake implementing it, which led me to completely rule it out from then on. So it was necessary to go through the full theory, only to realize that I already was on the correct path in the very beginning . At least I can now say I'm sure doing it correctly as opposed to only assuming it in the first place .
Now I'll go back to dyncrypt, implement my findings and go again through my tests... this will still need a few days.
Cheers
JÃŒrgen
---In hercules-***@yahoogroups.com mailto:hercules-***@yahoogroups.com, <***@...> mailto:***@... wrote :
Hi Paul, Gert
just letting you know: Problem solved (hopefully).
I'll now do some plausibility checks to be as confident as possible that things on the XTS side do work now as expected. Paul's OpenSSL tests will then hopefully work cleanly too...
Additionally I'll go over the KIMD GHASH function to verify whether this one is working correctly or is broken too. If necessary it will get the same fix applied as KM/PCC now have for XTS.
Given my current time constraints these activities will probably take some additional two or three days. I'll publish a patch once I'm done with this (currently it's some 200 lines of code changed in dyncrypt.c, which I consider a major change, although a big part of it is the precomputed exp_table).
Cheers
JÃŒrgen