Git Product home page Git Product logo

Comments (12)

enh-google avatar enh-google commented on July 21, 2024

yeah, i've struggled to even explain the problem to the maintainer --- https://sourceforge.net/p/sevenzip/bugs/2383/

i don't think they think armv7 is a real thing.

from ndk.

DanAlbert avatar DanAlbert commented on July 21, 2024

Closing as it sounds like this is a 7-zip bug, not an NDK bug. If I've misunderstood, just lmk and we can reopen.

from ndk.

mgood7123 avatar mgood7123 commented on July 21, 2024

this would apply to other projects using AES encryption (not just 7-zip)

from ndk.

mgood7123 avatar mgood7123 commented on July 21, 2024

(my current workaround is to disable such AES/SHA256 code from compiling when targeting __ANDROID__ arm cpu's)

from ndk.

mgood7123 avatar mgood7123 commented on July 21, 2024

tho this then introduces a situation where x86 based android devices support AES encryption and arm based android devices do not support AES encryption

from ndk.

DanAlbert avatar DanAlbert commented on July 21, 2024

this would apply to other projects using AES encryption (not just 7-zip)

But in each case it's the projects that are wrong, right? The problem here is that projects are assuming availability of optional hardware features?

from ndk.

enh-google avatar enh-google commented on July 21, 2024

tho this then introduces a situation where x86 based android devices support AES encryption and arm based android devices do not support AES encryption

no, because Android's x86-64 ABI also doesn't include AES. (but again, you may happen to be running on a device that does, given that your x86-64 "device" is likely a modern laptop!) but if your code assumes x86-64 AES, it's still strictly wrong.

look at zlib for an example of how to do this kind of thing correctly.

from ndk.

pirama-arumuga-nainar avatar pirama-arumuga-nainar commented on July 21, 2024
#define ATTRIB_AES __attribute__((__target__("+crypto")))

This indicates that the code is trying to do the right thing. This attribute should build functions with aes support even if the source file isn't: https://godbolt.org/z/Ts934oox5. Can you check if the attribute is set at the relevant functions (or share a repro)?

how can i determine if support for the vaeseq_u8 intrinsic is actually present on my device

The library would also need to do runtime detection using a cpu-features library (or use ifuncs) to check if crypto is available on the device.

from ndk.

enh-google avatar enh-google commented on July 21, 2024

This indicates that the code is trying to do the right thing

well, for armv8 --- my point was that it's broken for armv7: https://sourceforge.net/p/sevenzip/bugs/2383/

from ndk.

pirama-arumuga-nainar avatar pirama-arumuga-nainar commented on July 21, 2024

well, for armv8 --- my point was that it's broken for armv7: https://sourceforge.net/p/sevenzip/bugs/2383/

Aah, yea, that's correct. @mgood7123 if you're already modifying the library code, use enh's suggested fix - to move the aes functions to a separate file and compile it for armv8.

from ndk.

mgood7123 avatar mgood7123 commented on July 21, 2024

so to be clear

on "desktop" x86 devices, AES support is (probably?) high

on "android" x86/arm devices, AES support is low (optional but probably only rarely actually supported in the cpu itself, eg one x86 device may have AES support while another x86 device lacks AES support)

would this be right?

from ndk.

enh-google avatar enh-google commented on July 21, 2024

on "android" x86/arm devices, AES support is low (optional but probably only rarely actually supported in the cpu itself, eg one x86 device may have AES support while another x86 device lacks AES support)

i don't think "high" or "low" are really the point --- the point is that it's not guaranteed so you need to check at runtime (with if ((getauxval(AT_HWCAP) & HWCAP_AES) != 0) for arm64, say), and then either call the routine that uses the instruction or a routine that doesn't.

lzma tries to do this but (as explained in https://sourceforge.net/p/sevenzip/bugs/2383/) they got it wrong, or at least "don't believe that armv7 still exists".

from ndk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.