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 9238545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:47:16+00:00 2026-06-18T07:47:16+00:00

I’m using libgcrypt 1.5.0 under GNU/Linux to develop a small aes256-cbc file encryption software.

  • 0

I’m using libgcrypt 1.5.0 under GNU/Linux to develop a small aes256-cbc file encryption software.

I have a doubt regarding secure memory and data swapped out to disk.

Let’s say I have this code:

char *crypto_key;
crypto_key = gcry_malloc_secure(256);

Is it useful and necessary to do also these two things?

1) to not allow that memory to be paged with: mlock(crypto_key, size)

2) To prevent the information from being written to a core dump with:

struct rlimit limit;
limit.rlim_cur = 0;
limit.rlim_max = 0;
if (setrlimit(RLIMIT_CORE, &limit) != 0) {
    /* Handle error */
}
  • 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-06-18T07:47:18+00:00Added an answer on June 18, 2026 at 7:47 am

    Without preventing writing memory areas into the page file (or code dump), sensitive data (keys) might be left written onto disk and found by someone not intended to see/have the data. Whether it’s necessary/useful depends on application. Not doing that could leave secret keys or unencrypted data lying around on laptop’s hard drive for a long time, where somebody could then acquire the keys/data from by stealing the laptop. For private use on a physically secure computer, it might not be necessary (but is still good practice, because it’s better to prepare for anything).

    You don’t need to lock the memory (allocated crypto_key) yourself, libgcrypt does it for you (assuming you initialized the library properly). It should also clear/overwrite the memory once freed.

    Preventing core dump might be overkill since the original unencrypted file is likely still available on the machine, along with the keys. Depends on level of security you’re attempting to achieve. If you don’t have a dump file, you also won’t forget to delete it.

    Typically the user/admin of the machine should configure the machine to not do core dumps, tool programs are not the ones supposed to change the settings (and likely cannot even do it without elevated rights).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have an array which has BIG numbers and small numbers in it. I
I have thousands of HTML files to process using Groovy/Java and I need to
I have a reasonable size flat file database of text documents mostly saved in
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am using JSon response to parse title,date content and thumbnail images and place

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.