8000 Build failure on OS X ≤ 10.9 due to missing CommonCrypto/CommonRandom.h · Issue #384 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

Build failure on OS X ≤ 10.9 due to missing CommonCrypto/CommonRandom.h #384

Closed

Description

@ryandesign

Hi,

Just wanted to let you know that minizip 2.8.6 fails to build on OS X 10.9 and earlier because:

mz_crypt_apple.c:19:10: fatal error: 'CommonCrypto/CommonRandom.h' file not found
#include <CommonCrypto/CommonRandom.h>
         ^

Here are build failure logs for OS X 10.7, 10.8, and 10.9.

It builds fine on OS X 10.10 and later.

Activity

  1. nmoinvaz commented on Apr 30, 2019

    @nmoinvaz
    Member

    You can build instead using the Brian's Gladman's library -DMZ_BRG=ON or OpenSSL instead -DMZ_OPENSSL=ON

  2. Coeur commented on Apr 30, 2019

    @Coeur
    Collaborator

    Note that if you're coming from the branch 1.2, then it was historically using BRG (Brian's Gladman's AES lib), so -DMZ_BRG=ON will give you the least surprises.

  3. nmoinvaz commented on Apr 30, 2019

    @nmoinvaz
    Member

    I have added a check to the cmake in the dev branch that will check for the availablity of common crypto library.

  4. added
    compilationIssues related to compiling source code
    fixedIssue or bug has been fixed
    on May 1, 2019
  5. ryandesign commented on May 2, 2019

    @ryandesign
    Author

    You can build instead using the Brian's Gladman's library -DMZ_BRG=ON or OpenSSL instead -DMZ_OPENSSL=ON

    Thanks, I'll look into those.

    I have added a check to the cmake in the dev branch that will check for the availablity of common crypto library.

    Thanks, but it looks like you added a check for CommonCrypto.h, but the header you're using that's missing is CommonRandom.h.

    The first appearance of some of the Common Crypto functions was Mac OS X 10.4. The CommonCrypto.h header (which just includes some of the others) was added in OS X 10.8. The CommonRandom.h header (which contains the CCRandomGenerateBytes function minizip is using) was added in OS X 10.10.

  6. nmoinvaz commented on May 2, 2019

    @nmoinvaz
    Member

    Ok, I have updated it again. Thank you.

  7. nmoinvaz commented on May 2, 2019

    @nmoinvaz
    Member

    I'm not sure if it makes sense to use SecRandomCopyBytes instead. @Coeur thoughts?

  8. nmoinvaz commented on May 2, 2019

    @nmoinvaz
    Member

    I have changed it to use SecRandomCopyBytes which is available on 10.7. I wouldn't be surprised if underneath CCRandomCopyBytes it uses this function. Let me know if you have any issues with this.

  9. Coeur commented on May 2, 2019

    @Coeur
    Collaborator

    I'm not sure if it makes sense to use SecRandomCopyBytes instead. @Coeur thoughts?

    Regarding CommonCrypto.h, in my projects, I only target macOS 10.8+ for "modern" Objective-C or macOS 10.14.3+ for Swift with stable ABI, so I always have that header.

    Regarding CCRandomCopyBytes, it's partially open source: https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60074/lib/CommonRandom.c
    It does:

    rng = ccDRBGGetRngState();
    return ccrng_generate((struct ccrng_state *)(struct ccrng_CommonCrypto_state *)rng, count, bytes);

    So it has the same signature as SecRandomCopyBytes, and yes, they are probably interchangeable.

    And for the laugh, CommonCrypto is using Brian Gladman AES under the hood: https://opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/GladmanAES/

  10. nmoinvaz commented on May 2, 2019

    @nmoinvaz
    Member

    And for the laugh, CommonCrypto is using Brian Gladman AES under the hood: https://opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/GladmanAES/

    Haha that is a good laugh! It looks like more recent versions might not use it, still funny though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilationIssues related to compiling source codefixedIssue or bug has been fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0