-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standard PK (weak) decryption support, with basis for future AES decryption support. #49
Conversation
Thanks for your contribution, it looks like you've put a lot of effort into it, especially the decryption guts, and it generally looks good. Some comments: General Architecture
Some Detail
Style
We'll take another pass or two on the code before I'll merge it in. |
OK! my responses in the same order :-) General Architecture
Some Detail
Style
|
zipzap's interface must be pure Objective-C, and there should be no need for C++ runtime support (coming in a future commit). For all intents and purposes it should appear as an Objective-C library. Internally, we can use C++/Objective-C++ but we have to be careful not to use features that link in the C++ runtime a.k.a. libc++ or libstdc++ -- these would include virtual member functions, exception handling and the like. You will be able to test whether the feature links in the C++ runtime by simply testing the library; the test will no longer link in libc++ so it will fail to build if we ever inadvertently use such C++ features. I appreciate the speed and performance of C++ -- I've too have also come from the C/C++ world so I am with you here. So long as the performance code or tight inner loop is either C++ or straight C, you can still wrap it up in a Objective-C class without losing performance.
We are agreed on the stream composability. But do note that almost all the
I actually like exceptions, so we must agree to disagree :). However, I would trade exception support for removing libc++ dependency, and will do so in a future commit.
OK, no worries. You'll need to follow the
Hmmm… you really want to have a
Based on some of the concepts (although this is C++) here. Essentially all non-essential functions i.e. functions that can easily be composed from the core functions and otherwise do not touch class internals, should be external to the class. In Objective-C we have a slightly friendlier way of doing this, using a "category". I haven't decided whether to support extensive
Consider it an idiosyncrasy of mine. I hate wasted space :-) . |
Please rebase against the latest master, and if you're making changes that conceptually belong to an your earlier commits, would appreciate if you Thanks for your help! |
Excuse me but how do I do that safely? Rebase the repository on your HEAD, and keep the changes that I have made? And I apologize deeply for the rhyming - didn't mean to lol! |
See this, but replace the last step: |
Great! That worked. I'll work on it a little more and do a pull request |
@danielgindi, excellent! You don't have to make a new pull request, any changes in your branch will end up in the original pull request and we can continue conversing on it. Preferably also remove the last commit @47f7052 since it's a redundant merge e.g. if it is the last commit in your master branch, then |
OK so now I have completely removed any libc++ dependencies, so the hell of compiling in a new project is gone... I have taken care of most of the stuff we talked about, and now it's mostly ready to be "official", with interfaces that will allow easy overrides for when we support more encryptions. |
BTW that "redundant" merge was required to make SourceTree behave. I guess theoretically it IS redundant, but GUI apps cannot deduce that. |
Thanks for the hard work you've put into this. It looks much cleaner now, we're almost there! Source Control
|
General Architecture
Some Details
I assume you'd be revising the stream hierarchy before considering this work final. Otherwise, it looks neater and a worthy addition to the codebase! |
I'm not sure yet about the stream hierarchy, but after I play with it a little I'll be able to decide... |
The libc++ option is to incorporate the libc++ headers, which are C++11 compliant. If you omit it, it tries to incorporate the libstdc++ headers which are pre-C++11. For example, try the following:
Compiling with Since gcc 4.2 (Xcode 3?), Apple has not updated the system libstdc++, but only libc++. Therefore omitting The C99 option is mainly for consistency, since we already define C++11 and libc++ usage. But I also wanted to avoid inadvertently using too many non-standard C features, see this.
I fully agree with you. I believe that these options, as present in the Xcode project file, allow the project to be correctly built without any further mucking around. Also these options need not be set on any project that uses zipzap, we have effectively made it a black box by dropping the libc++ runtime dependency. |
Trying to rebase exactly as you detailed - ended up in a hell of merging. Before even going to source tree - it failed to rebase, saying I need to manually tell it how to apply |
OK, grant me contributor status on your project and I'll try to fix it. |
You can see for yourself in some of the most popular Objective-C github etc. repos: fmdb, cocos2d, appledoc, sparkle. I'll accept declaring the categories in the same header file, but the implementation should at least be in a separate .m file. B) Some future categories might need access to private members of the ZZArchive. Not generally a good idea. For example, in the NSArray design, the core functionality is expressed with just Effectively, categories are a "second-class" interface which needs to use the "first-class" interface of the object itself, which is a good thing for extensibility. |
You have a point with |
Virtual functions require linking in libc++. For proof, try the following:
When compiled with Therefore if you use virtual functions you necessarily force the library user to also link in libc++, which is what we wanted to avoid in the first place.
There is no explicit "transfer of ownership" -- either an ARC object pointer or a |
We can cross that bridge when we come to it. However consider that all Mac OS X and iOS machines already have openssl on them, so it's a dependency that's already present. (Unlike libc++, which is only present on modern Mac and iOS machines, whereas libstdc++ is present on older machines…) |
The CRC check in |
OK I'm going to add a commit that addes the |
Yes, but our internal standard is C++ enum classes, because of their convenience/neatness in C++ code. The library is not meant to be added as sources to other projects -- but if other projects want to do that to access the internal goodies, they have to play by the internal rules... |
Don't expose these internals. |
The trouble is this: whenever you first access the
Yes, I agree it's not ideal that an "erroneous" object ends up being created, it goes against basic object-oriented principles. However in this case it's a tradeoff to allow familiar container-based navigation of the zip file with little memory overhead i.e. by just iterating through |
I've added you as a collaborator. I hope you can fix the Git as you like :-) |
I've done some changes according to our conversations from today; The streams are now single responsibility, error handling is not done in the |
Thanks for your trust. Give me about 10-15 mins and don't commit anything to it. I'll tell you how it went. |
OK, I've removed the extraneous commit and forced an update. To update your local branch, look at this. In particular, you'll need to:
|
Worked great :-) |
Do you know, if one day I delete my copy of your git, will it harm your git's history? |
Please don't rely on the OS's version of openssl. Doing so has been deprecated by Apple some time now, and they recommend you ship your own if needed, instead. |
@danielgindi -- if you delete your git, it shouldn't harm the main git, since branches effectively maintain a reference count to their commits, therefore so long as there some branch somewhere referring to it, the commits will remain. Typically, github contributors will maintain a master branch sync'ed to the original project branch, and another branch that expresses the pull request. That way, you could do separate development of another branch for another pull request, and always keep the master "clean". See for example this and that. |
@mikeabdullah -- good point, looks like we could use Common Crypto which is available back to OS X 10.5 and iOS 5.0. Conveniently we only profess compatibility with OS X 10.7 and iOS 5.0 and later. |
Yes, if it meets your needs, you'd likely be mad not to use CommonCrypto for a project like this. |
@mikeabdullah Yes, when I get to it, I'll look into CommonCrypto first. Do you have a need for AES right now? @pixelglow I'm pretty satisfied with the result right now. Do you want to merge into your master branch? |
Nope, I'm not even using zipzap; just an interested party |
@danielgindi -- we're almost there, but you would need to address:
But if you're happy with it now, I can massage the code a little to address the above while in your branch and before merging it. I'll leave it up to you whether you want to continue working on it. |
Well, go ahead :-) |
OK, folks, I've done some minor surgery before merging:
I'll work a little more on the |
Standard PK (weak) decryption support, with basis for future AES decryption support.
…rash to develop * commit '1a81ad79f41b5d08a42b228f986b079600ae89e3': Fixes some test cases UMOBILE-1047 Unify list item setup and paragraph style conversion
I may work on this a little more soon, to add AES.
I do not really need encryption right now, only decryption. So I'm not sure If I'll implement.