Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6839561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:44:00+00:00 2026-05-26T23:44:00+00:00

I have been trying to use the crypto api in the linux kernel, what

  • 0

I have been trying to use the crypto api in the linux kernel, what i need to do is sha a file that is being opened. I am using the LSM to catch those file opens.

What I have so far is creating a struct crypto_shash using

struct crypto_shash *tfm;
struct shash_desc desc;
tfm = crypto_alloc_shash("sha1", 0, CRYPTO_ALG_ASYNC);

and i assume i am supposed to init it after that using

desc.tfm = tfm;
desc.flags = 0;

err = crypto_shash_init(&desc);

that all works fine, but then i want to use

crypto_shash_digest(&desc, ??, ??, sha_hash);

and i realize that it expects a scatterlist as its second argument and the length of that scatter list as the third argument. What i cant figure out is how I am supposed to load the file into a scatterlist in order to give it to the crypto system.

I have done quite a bit of reading but have thus far been unable to find any details about getting a files contents loaded into a scatterlist. So any pointers in the right direction would be appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:44:01+00:00Added an answer on May 26, 2026 at 11:44 pm

    I have done something similar some time ago. The only difference is that I calculated a hash of ELF sections.

    1. Probably your desc.flags should be CRYPTO_TFM_REQ_MAY_SLEEP until you have really good reason to prevent crypto operation from blocking.
    2. Are you sure you didn’t confuse crypto_shash_digest with crypto_hash_digest? Because crypto_*s*hash_digest() receives a pointer to data as its 3rd argument. If it’s not true for you, what linux kenrel version are you talking about?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to use a formula that is used to work out
Right now I have been trying to use Launchpad's API to write a small
I have been trying to use an ajax-style file upload component (like the dojox
I have been trying to use Android's AudioManager.setMicrophoneMute() without much success. That is, it
I have been trying to use the server side api provided by Urban Airship
I have been trying to use Hibernate for a while. I like hibernate that
I have been trying to use the Perl utility/module "prove" as a test harness
I have been trying to use the latest NAnt (0.86 Beta 1) for a
I have been trying to use routes.rb for creating a URL /similar-to-:product (where product
I have been trying to use the hibernate dialect for SQLite from http://code.google.com/p/hibernate-sqlite/ in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.