Skip to content

duplicit FIPSKeysImporter tests, one for el10, the other for everything else..#39

Merged
judovana merged 5 commits intorh-openjdk:mainfrom
andrlos:disableFipsKeyImporterDSA
Oct 13, 2025
Merged

duplicit FIPSKeysImporter tests, one for el10, the other for everything else..#39
judovana merged 5 commits intorh-openjdk:mainfrom
andrlos:disableFipsKeyImporterDSA

Conversation

@andrlos
Copy link
Contributor

@andrlos andrlos commented Oct 9, 2025

SSIA, was done due to the fact that DSA is being decomissioned from fips systems starting el10
tested on ojdk17 on both el8 & 10

* @test
* @summary Test for RH1991003 - FIPS keys importer
* @requires (jdk.version.major >= 8)
* @requires os.version ~= ".*el10.*"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Whhere os version comes from?

Maybe split (add) better to https://github.com/rh-openjdk/jtreg-buffer/blob/550b97dd723545023993673648bbb3209cb87333/test/VarDeps.java so we can have os.name aka el, rhel, fedora... and os.versionNUmber ala 10.... And amyeb contribntue this to usptream?

In that moment there would be possibled to have os.versionNuimber >= 10 and we would be safe for next years.... @zzambers wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the os.version is a java property.. you can try the output (as did I) via System.getProperty("os.version"), I was not able to manage any kind of splitting inside the jtreg annotations :( the syntax is quite strict and I am glad that I was able to at least narrow like this
same with fips.. other than the ugly hack you guys are using with OTOOL fips variable, I was not able to detect the fips environment on its own inside the jtreg annotations.. unless we are able to do it, I don't think we can hope to propagate this to upstream

Copy link
Collaborator

Choose a reason for hiding this comment

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

This https://github.com/rh-openjdk/jtreg-buffer/blob/main/test/VarDeps.java is what you were supposed to enhance. And larter backportt it o upstream...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm okay, take a look now @judovana

/*
* @test
* @summary Test for RH1991003 - FIPS keys importer
* @requires !(os.version ~= ".*el10.*")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Otherwise nice solution.. bad luck it may bite any time soon.... Eg dsa disapearing en el9, or need of el11 ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well it should not dissapear on already existing rhels.. we shall see in the future, but my guess is that DSA will be decomissioned since el10 fips and el11 non-fips.. but older rhels will support it just fine

//doTestSignature("SHA1withDSA", rootCA0.getPrivateKey(JKS_ORIGIN),
// rootCA0.getPublicKey(JKS_ORIGIN));

TestCA rootCA1 = cas.get("root_ca_1");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I will leave on @zzambers how correct the algorithm listing is correct/enough. If you discussed with him, klet me know. TY!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think change is correct (removing DSA on rhel10, keeping others). I don't think there is anything more to be done (at least at this point).

@judovana
Copy link
Collaborator

judovana commented Oct 9, 2025

Btw the fips condition seems to bne missing...?

@andrlos
Copy link
Contributor Author

andrlos commented Oct 13, 2025

I need to redo the VarDeps to be jdk8 compatible

* @test
* @summary Test for RH1991003 - FIPS keys importer
* @requires os.version ~= ".*el10.*"
* @requires var.os.version.major >= 10 & var.sys.fips == "true"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great!

Feel free to correct me, but the "el" check shouldstay, right? So you may match & os.version ~= ".*el.*" or add some var.os.version.name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry I thought that rhel/fedora were the only OSes to feature fips.. okay.. I shall reinstate it.. I think that var.os.version.name would be unnecessary since I can just use this regex..

* @run main/othervm/timeout=30 FIPSKeysImporterDSA
*/

public final class FIPSKeysImporterDSA {
Copy link
Collaborator

Choose a reason for hiding this comment

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

One more thing - there is quite a lot of code shared between FipsKeysImporter*.java files. Any desire to share the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well honestly it was not my desire to do that, but fine :D

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nn. I do not insits at all. It brings another ttroubles. Feel free to extract only some, aor none at all

Copy link
Collaborator

Choose a reason for hiding this comment

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

It depends on your judgement of possible complexity removal/aditional and pros and cons of the selected shared logic.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Jdk8 adjustion have priority....

trying to mitigate duplicated code in FIPSKeysImporter classes
@andrlos
Copy link
Contributor Author

andrlos commented Oct 13, 2025

I just found out that this is not ready yet as is, in case it hits the el10 & fips combination it still triggers the DSA variant for some reason..

EDIT: nevermind.. I accidentaly force changed the msys variable on the line above instead of the fips one.. all good to merge

import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think nearly all imports are in FipsKesIMporter.java

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep... all of them actually.. NOW it should be OK :D sorry

@judovana
Copy link
Collaborator

I wanted to squash and merge, but then I noticed that non of the two tests is visible in GH - eg: https://github.com/rh-openjdk/jtreg-buffer/actions/runs/18463464820/job/52599940744?pr=39

IS it expected?

@zzambers
Copy link
Contributor

Looks ok to me. I think another alternative would be to pass different arg to test class on different systems (just having separate @test parts), but this also works.

@zzambers
Copy link
Contributor

I can only comment. Seems I don't have rights in this repo to approve. :)

@judovana
Copy link
Collaborator

I can only comment. Seems I don't have rights in this repo to approve. :)

Thats what i thought Jirik will do, but he did this.. so I was not nitpicking more...

// Could not read flag — assume non-FIPS
} finally {
if (br != null) {
try { br.close(); } catch (IOException ignored) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw. you could make use of try-with-resources here (jdk7+, I think), to make it a bit more elegant / less error prone.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@jandrlik pls do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah.. I vaguely remember this from school :D sorry

@andrlos
Copy link
Contributor Author

andrlos commented Oct 13, 2025

I wanted to squash and merge, but then I noticed that non of the two tests is visible in GH - eg: https://github.com/rh-openjdk/jtreg-buffer/actions/runs/18463464820/job/52599940744?pr=39

IS it expected?

with the ".el." filter it only runs on el systems -> not in GH actions

@judovana
Copy link
Collaborator

That do not seem right. * @requires (var.os.version.major < 10 | var.sys.fips == "false") & (os.version ~= ".*el.*") seems tobe wrong then. It should run on anything except el10 in fips, shouldnt it?

@andrlos
Copy link
Contributor Author

andrlos commented Oct 13, 2025

yeah, it definitely should.. fix would be something like:
* @requires var.sys.fips == "true" & ( ! (os.version ~= ".*el.*") | var.os.version.major >= 10 )

translated to common speech would be "we require for it to be FIPS AND (for it to NOT be RHEL OR be at least of os.version 10)"

- redone the logic statements in require to allow non-el OSes
@andrlos
Copy link
Contributor Author

andrlos commented Oct 13, 2025

@judovana OK, now!!

Copy link
Collaborator

@judovana judovana left a comment

Choose a reason for hiding this comment

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

Awesome!

@judovana judovana merged commit b747d1f into rh-openjdk:main Oct 13, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants