Security.framework: support for gzip format in kSecZLibEncoding transforms

Originator:jens.ayton
Number:rdar://10323742 Date Originated:2011-10-21
Status:Open Resolved:
Product:Mac OS X Product Version:10.7
Classification:Enhancement Reproducible:n/a
 
Summary:
Assuming the kSecZLibEncoding encoder/decoder transforms are wrappers around zlib, supporting gzip format in addition to zlib format and raw deflate is essentially free, saving users of the API from implementing near-identical transforms.

Steps to Reproduce:
Pass gzip data to a transform created with SecDecodeTransformCreate(kSecZLibEncoding, ...)

Expected Results:
Decompressed data.

Actual Results:
com.apple.security.transforms.error error 10 - Zlib error#-3

Regression:
n/a

Notes:
Gzip format differs from zlib format only in that it has a different header. For decompression, transparent gzip support in zlib is enabled by adding 32 to the windowBits parameter to inflateInit2(). (inflateInit() is equivalent to inflateInit2(..., 15).) If it is preferable to control gzip support with an explicit attribute, you can require a gzip header by adding 16 instead of 32.

Similarly, it is possible to generate gzip format with zlib simply by adding 16 to the windowBits parameter of deflateInit2(). (deflateInit() is equivalent to deflateInit2(..., Z_DEFLATED, 15, 8, Z_DEFAULT_STRATEGY).) In this case, an explicit parameter would be required. Using deflateInit2() to generate gzip data is somewhat limited since the metadata in the gzip header will be empty, but this would still be convenient.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!