Skip to content

Conversation

@nklazy
Copy link
Contributor

@nklazy nklazy commented May 16, 2025

Adds initial test script and supporting documentation to validate qcom_hwrng integration and functionality.

Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Please update your signed-off-by to use first and last name.

@nklazy
Copy link
Contributor Author

nklazy commented May 27, 2025

Please update your signed-off-by to use first and last name.

@mwasilew In the latest commit, I expanded the last name and signed off, but the DCO Signed off check is failing.

Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

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

Please rebase this feature branch on top of latest main. This helps to review the PR easier and merge.

Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Please squash the commits

@nklazy
Copy link
Contributor Author

nklazy commented Jun 12, 2025

Rebased and Squashed all commits on this feature branch on top of latest main

Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Code looks OK. The markdown file is missing copyright statement. Please fix the commiter email. This is what the automated checks are complaining about:

Invalid email for Committer: [email protected]

Set the email in the repository (or globally)

git config user.email your_email@address
git congig user.name "Your Name"

After that rewrite the commit

git commit --amend -s --reset-author

@nklazy
Copy link
Contributor Author

nklazy commented Jun 12, 2025

Thanks @mwasilew, Amended with changed committer email

Copy link
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

Please add Qualcomm's copyright to the .md file. I think this is the last missing bit

@nklazy
Copy link
Contributor Author

nklazy commented Jun 12, 2025

Please add Qualcomm's copyright to the .md file. I think this is the last missing bit

Done

mwasilew
mwasilew previously approved these changes Jun 12, 2025
@smuppand smuppand self-requested a review June 12, 2025 14:26
Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

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

Few minor changes are required.

@nklazy
Copy link
Contributor Author

nklazy commented Jun 17, 2025

Amended with changes.

@nklazy nklazy force-pushed the main branch 2 times, most recently from 6e87484 to c140375 Compare June 17, 2025 09:17
@nklazy nklazy force-pushed the main branch 2 times, most recently from 24bbd48 to 6fbb4aa Compare June 17, 2025 11:58
Copy link
Contributor

@smuppand smuppand left a comment

Choose a reason for hiding this comment

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

Still few more changes are needed

@nklazy
Copy link
Contributor Author

nklazy commented Jul 2, 2025

Still few more changes are needed

Amended with changes suggested

@vnarapar
Copy link
Contributor

vnarapar commented Jul 2, 2025

Remove unwanted commit

@nklazy
Copy link
Contributor Author

nklazy commented Jul 10, 2025

Done

@github-actions
Copy link

This pull request has been marked as stale due to 30 days of inactivity. To prevent automatic closure in 7 days, remove the stale label or add a comment. You can reopen a closed pull request at any time.

@github-actions github-actions bot added the Stale label Aug 14, 2025
@nklazy nklazy removed the Stale label Aug 19, 2025
@vnarapar
Copy link
Contributor

Please address the shell check failure

@vnarapar
Copy link
Contributor

Rebase to the latest and remove the directories(FunctionalArea) which are not required.

@github-actions
Copy link

This pull request has been marked as stale due to 30 days of inactivity. To prevent automatic closure in 7 days, remove the stale label or add a comment. You can reopen a closed pull request at any time.

@github-actions github-actions bot added the Stale label Oct 13, 2025
@github-actions github-actions bot closed this Oct 20, 2025
@nklazy nklazy reopened this Oct 24, 2025
@vnarapar
Copy link
Contributor

@nklazy is this PR still required?

@nklazy
Copy link
Contributor Author

nklazy commented Oct 24, 2025

@nklazy is this PR still required?

Yes, will commit will latest changes.

@nklazy nklazy force-pushed the main branch 2 times, most recently from 8f8e6a1 to 082be94 Compare October 24, 2025 11:45
@github-actions github-actions bot removed the Stale label Oct 25, 2025
- Added initial test script to validate Qualcomm HWRNG functionality
- Refined script and documentation based on review feedback

Signed-off-by: Naveenkumar Suresh <[email protected]>
@nklazy
Copy link
Contributor Author

nklazy commented Oct 28, 2025

Amended with changes suggested

log_info "=== Test Initialization ==="

log_info "Checking if dependency binary is available"
check_dependencies rngtest dd
Copy link
Contributor

Choose a reason for hiding this comment

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

SKIP the test if dependencies are not met

check_dependencies rngtest dd

# Set the hardware RNG source to Qualcomm's RNG
RNG_PATH="/sys/class/misc/hw_random/rng_current"
Copy link
Contributor

Choose a reason for hiding this comment

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

you should verify it’s actually available before selecting it, and restore the previous provider on exit. Writing to rng_current needs root. Either enforce root at top, or emit SKIP if not root.


TMP_OUT="./qcom_hwrng_output.txt"
ENTROPY_B=20000032
RNG_SOURCE="/dev/random"
Copy link
Contributor

Choose a reason for hiding this comment

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

You’re reading from /dev/random, which is the kernel CSPRNG pool, not raw HWRNG output. To validate qcom HWRNG specifically, read from /dev/hwrng (and ensure it exists).

log_info "Running rngtest with $ENTROPY_B bytes of entropy from $RNG_SOURCE..."

# Generate entropy and run rngtest
if ! dd if="$RNG_SOURCE" bs=1 count="$ENTROPY_B" status=none 2>/dev/null | rngtest -c 1000 2>&1 | tee "$TMP_OUT"; then
Copy link
Contributor

Choose a reason for hiding this comment

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

dd | rngtest | tee checks the exit status of tee, not rngtest. In POSIX sh, there’s no pipefail. Capture rngtest’s status by avoiding a pipe for the final command.


TESTNAME="qcom_hwrng"
test_path=$(find_test_case_by_name "$TESTNAME")
cd "$test_path" || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

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

If find_test_case_by_name returns empty or cd fails, you exit without writing .res. Add a fallback and always emit .res.

fi

# Parse FIPS 140-2 failures
failures=$(awk '/FIPS 140-2 failures:/ {print $NF}' "$TMP_OUT" | head -n1)
Copy link
Contributor

Choose a reason for hiding this comment

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

You’re parsing FIPS 140-2 failures. Keeping a small threshold (e.g., < 10) is fine, but make it a variable and log it.

failures=$(awk '/FIPS 140-2 failures:/ {print $NF}' "$TMP_OUT" | head -n1)
rm -f "$TMP_OUT"

if [ -z "$failures" ] || ! echo "$failures" | grep -Eq '^[0-9]+$'; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Anchor on the expected prefix to avoid accidental matches

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