All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] How to compress LUKS2 header?
@ 2019-12-23 14:41 Julio Faracco
  2019-12-27 15:56 ` ken
  0 siblings, 1 reply; 8+ messages in thread
From: Julio Faracco @ 2019-12-23 14:41 UTC (permalink / raw)
  To: dm-crypt

Hi all,

I'm trying to compress a LUKS2 header file, but I'm not seeing any
sensible reduction.
I used ZIP and I got 0% of reduction. :-(
Do you have any suggestions of what algorithm should be used to
compress this type of file?

Thanks!

--
Julio Cesar Faracco

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-23 14:41 [dm-crypt] How to compress LUKS2 header? Julio Faracco
@ 2019-12-27 15:56 ` ken
  2019-12-27 16:20   ` Michael Kjörling
  0 siblings, 1 reply; 8+ messages in thread
From: ken @ 2019-12-27 15:56 UTC (permalink / raw)
  To: dm-crypt

On 12/23/19 9:41 AM, Julio Faracco wrote:
> Hi all,
>
> I'm trying to compress a LUKS2 header file, but I'm not seeing any
> sensible reduction.
> I used ZIP and I got 0% of reduction. :-(
> Do you have any suggestions of what algorithm should be used to
> compress this type of file?
>
> Thanks!
>
> --
> Julio Cesar Faracco
> _______________________________________________

Compressing a file is one step in the encryption of that file.  So if
your LUKS2 header file is encrypted, it's also already compressed. 
Using ZIP on it would yield no further compression.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-27 15:56 ` ken
@ 2019-12-27 16:20   ` Michael Kjörling
  2019-12-27 16:27     ` Arno Wagner
  2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Kjörling @ 2019-12-27 16:20 UTC (permalink / raw)
  To: dm-crypt

On 27 Dec 2019 10:56 -0500, from gebser@mousecar.com (ken):
> Compressing a file is one step in the encryption of that file.  So if
> your LUKS2 header file is encrypted, it's also already compressed. 
> Using ZIP on it would yield no further compression.

No, encryption does not imply compression. Rather, trying to compress
ciphertext is a largely pointless exercise if the encryption is any
good in the first place; therefore, _if_ you're going to compress the
data you're encrypting (keeping in mind that doing so is not always a
good idea; see compression oracle attacks), then you need to compress
first, then encrypt, not the other way around.

I'm pretty sure the LUKS header backup isn't compressed.

-- 
Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se
 “Remember when, on the Internet, nobody cared that you were a dog?”

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-27 16:20   ` Michael Kjörling
@ 2019-12-27 16:27     ` Arno Wagner
  2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
  1 sibling, 0 replies; 8+ messages in thread
From: Arno Wagner @ 2019-12-27 16:27 UTC (permalink / raw)
  To: dm-crypt

On Fri, Dec 27, 2019 at 17:20:11 CET, Michael Kjörling wrote:
> On 27 Dec 2019 10:56 -0500, from gebser@mousecar.com (ken):
> > Compressing a file is one step in the encryption of that file.  So if
> > your LUKS2 header file is encrypted, it's also already compressed. 
> > Using ZIP on it would yield no further compression.
> 
> No, encryption does not imply compression. Rather, trying to compress
> ciphertext is a largely pointless exercise if the encryption is any
> good in the first place; therefore, _if_ you're going to compress the
> data you're encrypting (keeping in mind that doing so is not always a
> good idea; see compression oracle attacks), then you need to compress
> first, then encrypt, not the other way around.

Well, actually compressing encrypted data is very easy. It just 
has one mandatory condition that has to be met: You have to be able
to decrypt. Moden ciphers make sure you can only do that when
you have the key. 


> I'm pretty sure the LUKS header backup isn't compressed.

It is not. Also, the anti-forensic stripes are not encyption.
They are basically an all-or-nothing transformation and that 
is different form encryption.

Regards,
Arno

> -- 
> Michael Kjörling • https://michael.kjorling.se • michael@kjorling.se
>  “Remember when, on the Internet, nobody cared that you were a dog?”
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> https://www.saout.de/mailman/listinfo/dm-crypt

-- 
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno@wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-27 16:20   ` Michael Kjörling
  2019-12-27 16:27     ` Arno Wagner
@ 2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
  2019-12-27 21:19       ` Milan Broz
  2019-12-28  0:20       ` Arno Wagner
  1 sibling, 2 replies; 8+ messages in thread
From: Julio Cesar Faracco - jfaracco@br.ibm.com @ 2019-12-27 20:46 UTC (permalink / raw)
  To: dm-crypt

Thanks for your suggestions, guys...

Do you have any recommendation to reduce this header size then?
Imagine 1000 lab machines.. They are taking 20 GB to backup each header.

Revert to LUKS v1 type is not a possibility.

I appreciate your help...

--
Julio  Cesar Faracco

    
From: dm-crypt <dm-crypt-bounces@saout.de> on behalf of Michael Kjörling <michael@kjorling.se>
Sent: Friday, December 27, 2019 1:20:11 PM
To: dm-crypt@saout.de
Subject: [EXTERNAL] Re: [dm-crypt] How to compress LUKS2 header?
    
On 27 Dec 2019 10:56 -0500, from gebser@mousecar.com (ken):
> Compressing a file is one step in the encryption of that file.  So if
> your LUKS2 header file is encrypted, it's also already compressed. 
> Using ZIP on it would yield no further compression.

No, encryption does not imply compression. Rather, trying to compress
ciphertext is a largely pointless exercise if the encryption is any
good in the first place; therefore, _if_ you're going to compress the
data you're encrypting (keeping in mind that doing so is not always a
good idea; see compression oracle attacks), then you need to compress
first, then encrypt, not the other way around.

I'm pretty sure the LUKS header backup isn't compressed.

-- 
Michael Kjörling •  https://urldefense.proofpoint.com/v2/url?u=https-3A__michael.kjorling.se&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=ZRo7ioNm6-KW9XMwc8-3Aqc6TBVFd8_9yk27A36m0u0&m=rQUoPqXVjthTyHfeJ02oW6vvxq9wwNPVBB1anj-N7kI&s=worTWmhb84zgfP27r3HYCW1CSw9M_93ZnC2rb_81SfQ&e=  • michael@kjorling.se
 “Remember when, on the Internet, nobody cared that you were a dog?”

_______________________________________________
dm-crypt mailing list
dm-crypt@saout.de
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.saout.de_mailman_listinfo_dm-2Dcrypt&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=ZRo7ioNm6-KW9XMwc8-3Aqc6TBVFd8_9yk27A36m0u0&m=rQUoPqXVjthTyHfeJ02oW6vvxq9wwNPVBB1anj-N7kI&s=pg-I-9_hpvWliVyuS2yTJk_kfFNljzWR1YSIUcHluIg&e=
    

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
@ 2019-12-27 21:19       ` Milan Broz
  2019-12-28  0:20       ` Arno Wagner
  1 sibling, 0 replies; 8+ messages in thread
From: Milan Broz @ 2019-12-27 21:19 UTC (permalink / raw)
  To: Julio Cesar Faracco - jfaracco@br.ibm.com, dm-crypt

On 27/12/2019 21:46, Julio Cesar Faracco - jfaracco@br.ibm.com wrote:
> Thanks for your suggestions, guys...
> 
> Do you have any recommendation to reduce this header size then?
> Imagine 1000 lab machines.. They are taking 20 GB to backup each header.

Hi,

just few notes:

- used keyslots areas (both in LUKSv1 and LUKSv2) cannot be compressed,
it contains encrypted keyslot data.

- unused keyslot binary areas are filled by a random data on format (or wipe), so
these areas cannot be compressed either. (For LUKSv2 it is the whole binary area.)

That said...

We can probably add some option to wipe unused keyslot areas with zeroes
on backup.

For the header size - for LUKSv2 you can easily decrease header size,
if you do not need more slot area or you do not plan to use reencryption.

Please read this post
https://marc.info/?l=dm-crypt&m=157146906003981&w=2

Milan



> 
> Revert to LUKS v1 type is not a possibility.
> 
> I appreciate your help...
> 
> --
> Julio  Cesar Faracco
> 
>      
> From: dm-crypt <dm-crypt-bounces@saout.de> on behalf of Michael Kjörling <michael@kjorling.se>
> Sent: Friday, December 27, 2019 1:20:11 PM
> To: dm-crypt@saout.de
> Subject: [EXTERNAL] Re: [dm-crypt] How to compress LUKS2 header?
>      
> On 27 Dec 2019 10:56 -0500, from gebser@mousecar.com (ken):
>> Compressing a file is one step in the encryption of that file.  So if
>> your LUKS2 header file is encrypted, it's also already compressed.
>> Using ZIP on it would yield no further compression.
> 
> No, encryption does not imply compression. Rather, trying to compress
> ciphertext is a largely pointless exercise if the encryption is any
> good in the first place; therefore, _if_ you're going to compress the
> data you're encrypting (keeping in mind that doing so is not always a
> good idea; see compression oracle attacks), then you need to compress
> first, then encrypt, not the other way around.
> 
> I'm pretty sure the LUKS header backup isn't compressed.
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dm-crypt] How to compress LUKS2 header?
  2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
  2019-12-27 21:19       ` Milan Broz
@ 2019-12-28  0:20       ` Arno Wagner
  1 sibling, 0 replies; 8+ messages in thread
From: Arno Wagner @ 2019-12-28  0:20 UTC (permalink / raw)
  To: dm-crypt

On Fri, Dec 27, 2019 at 21:46:50 CET, Julio Cesar Faracco - jfaracco@br.ibm.com wrote:
> Thanks for your suggestions, guys...
> 
> Do you have any recommendation to reduce this header size then?
> Imagine 1000 lab machines.. They are taking 20 GB to backup each header.

Your situation becomes clearer ;-)
What I do not quite get is why you have header backups but 
(apparently) no data backups. You usually should do both.

As Milan suggested, you can cut off the header after the last 
used keyslot. In LUKS 1 you could also do some ciper magic
(See FAQ Item 6.13), no idea whether that works with LUKS 2
or whether it is secure for your situation.

Other than that, 20GB is not that much in this day and age. 

Regards,
Arno

 
> Revert to LUKS v1 type is not a possibility.
> 
> I appreciate your help...
> 
> --
> Julio  Cesar Faracco
> 
>     
> From: dm-crypt <dm-crypt-bounces@saout.de> on behalf of Michael Kjörling <michael@kjorling.se>
> Sent: Friday, December 27, 2019 1:20:11 PM
> To: dm-crypt@saout.de
> Subject: [EXTERNAL] Re: [dm-crypt] How to compress LUKS2 header?
>     
> On 27 Dec 2019 10:56 -0500, from gebser@mousecar.com (ken):
> > Compressing a file is one step in the encryption of that file.  So if
> > your LUKS2 header file is encrypted, it's also already compressed. 
> > Using ZIP on it would yield no further compression.
> 
> No, encryption does not imply compression. Rather, trying to compress
> ciphertext is a largely pointless exercise if the encryption is any
> good in the first place; therefore, _if_ you're going to compress the
> data you're encrypting (keeping in mind that doing so is not always a
> good idea; see compression oracle attacks), then you need to compress
> first, then encrypt, not the other way around.
> 
> I'm pretty sure the LUKS header backup isn't compressed.
> 
> -- 
> Michael Kjörling •  https://urldefense.proofpoint.com/v2/url?u=https-3A__michael.kjorling.se&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=ZRo7ioNm6-KW9XMwc8-3Aqc6TBVFd8_9yk27A36m0u0&m=rQUoPqXVjthTyHfeJ02oW6vvxq9wwNPVBB1anj-N7kI&s=worTWmhb84zgfP27r3HYCW1CSw9M_93ZnC2rb_81SfQ&e=  • michael@kjorling.se
>  “Remember when, on the Internet, nobody cared that you were a dog?”
> 
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.saout.de_mailman_listinfo_dm-2Dcrypt&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=ZRo7ioNm6-KW9XMwc8-3Aqc6TBVFd8_9yk27A36m0u0&m=rQUoPqXVjthTyHfeJ02oW6vvxq9wwNPVBB1anj-N7kI&s=pg-I-9_hpvWliVyuS2yTJk_kfFNljzWR1YSIUcHluIg&e=
>     
> _______________________________________________
> dm-crypt mailing list
> dm-crypt@saout.de
> https://www.saout.de/mailman/listinfo/dm-crypt

-- 
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: arno@wagner.name
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -- Plato

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dm-crypt] How to compress LUKS2 header?
@ 2019-12-26 20:12 Julio Cesar Faracco - jfaracco@br.ibm.com
  0 siblings, 0 replies; 8+ messages in thread
From: Julio Cesar Faracco - jfaracco@br.ibm.com @ 2019-12-26 20:12 UTC (permalink / raw)
  To: dm-crypt

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

Hi all,

I'm trying to compress a LUKS2 header file, but I'm not seeing any
sensible reduction.
I used ZIP and GZIP, but I got 0% of reduction. :-(
Do you have any suggestions of what algorithm should be used to
compress this type of file?

Thanks!

--
Julio  Cesar Faracco

[-- Attachment #2: OutlookEmoji-LinkedIn: http://br.linkedin.com/pub/julio-faracco/43/681/39791ef43e7-00a7-4ae7-bfdc-e90de97a736f.png --]
[-- Type: image/png, Size: 962 bytes --]

[-- Attachment #3: OutlookEmoji-Blogger: http://juliofaracco.blogspot.com.br/7acffea9-ae8b-4e7c-bd26-df0eb33faaaf.png --]
[-- Type: image/png, Size: 802 bytes --]

[-- Attachment #4: OutlookEmoji-Facebook: http://www.facebook.com/julio.faracco89694cc7-6d07-4424-b0e5-703e22cd28a2.png --]
[-- Type: image/png, Size: 843 bytes --]

[-- Attachment #5: OutlookEmoji-IBM06e9eef8-8ca7-4204-9482-dac7478f14e5.png --]
[-- Type: image/png, Size: 434 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-12-28  0:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 14:41 [dm-crypt] How to compress LUKS2 header? Julio Faracco
2019-12-27 15:56 ` ken
2019-12-27 16:20   ` Michael Kjörling
2019-12-27 16:27     ` Arno Wagner
2019-12-27 20:46     ` Julio Cesar Faracco - jfaracco@br.ibm.com
2019-12-27 21:19       ` Milan Broz
2019-12-28  0:20       ` Arno Wagner
2019-12-26 20:12 Julio Cesar Faracco - jfaracco@br.ibm.com

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.