During the creation of an encrypted file in AIX, I received this error:

$ openssl enc -aes-256-cbc -salt -in test.img -out test.img.enc 

test.img: Value too large to be stored in data type
14221428:error:0200107F:system library:fopen:Value too large to be stored in:bss_file.c:356:fopen('test.img','r')
14221428:error:20074002:BIO routines:FILE_CTRL:system lib:bss_file.c:358:

test.img File Size is is 35GB

The same command worked in Linux for 100GB file.

  • 1
    Is this the openssl that came with AIX, or did you install it separately? It sounds like it was not compiled to handle large files. Knowing the version may help as well: openssl version.
    – Jeff Schaller
    Mar 5 '16 at 17:04
  • 3
    Does it help if you use pipes to prevent openssl from knowing anything about the size of the input and output files? Something like cat test.img | openssl enc -aes-256-cbc -salt | cat >test.img.enc
    – Celada
    Mar 5 '16 at 17:08
  • EHLO. Pls show the output from truss openssl enc -aes-256-cbc -salt -in test.img -out test.img.enc
    – MAQ
    Mar 5 '16 at 21:28
  • Thanks all , YES it is default openssl came with AIX - OpenSSL 0.9.8r 8 Feb 2011.
    – Daya
    Mar 8 '16 at 4:24
  • 2
    You might be running into a 2 GiB / 32 bit limitation - stackoverflow.com/questions/1746751/… - try on a file that's just over 2GiB and then one that's just under.
    – Liczyrzepa
    Dec 21 '16 at 22:18

Based on the error, your copy of openssl isn't compiled or linked with large file support. fopen probably fails because it tries to discover the size of the file right after opening it and fails.

The trick, then, is to make openssl read from a pipe and write to a pipe. Pipes have no size, and fopen knows this, so it should be fine with it. The things at the other ends of the pipes don't need to do anything fancy, they just need to be passthrough filters between openssl and the actual files. That's exactly what cat's job is. cat, which now becomes the thing directly exposed to the large file, needs to have large file support, but as an OS-supplied basic utility, let's assume that it does.

cat test.img | openssl enc -aes-256-cbc -salt | cat >test.img.enc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.