Skip to content

error.0400008d.RSA routines.OPENSSL_internal.TOO_MANY_ITERATIONS  #136

Open

Description

@avinashboy

Recently, I've been getting this issue while creating the public key in debug mode. However, if I build the APK and test it on an Android box or Android TV,

I get this error: error.0400008d:RSA routines:OPENSSL_internal:TOO_MANY_ITERATIONS in Flutter.

WhatsApp Image 2024-06-17 at 11 33 18 AM

Activity

  1. avinashboy commented on Jun 18, 2024

    @avinashboy
    Author

    Device info is here:

    Android TV OS Name: 11
    Ram: 4GB
    Model: Android 11RTC Mini PC
    Device name: Leoxsys android mini pc

  2. jonasfj commented on Jun 26, 2024

    @jonasfj
    Member

    What are you trying to do?

    I'm not a crypto expert, certainly not an embedded expert, but could this be a combination of low powered platform, little randomness available and aiming for large primes?

    A quick search yielded: openssl/openssl#4151

    It's possible we should figure out what the error is, and print a nicer message.

    Now I wouldn't dare to give advice on how to do cryptographic protocols, but it's thinkable that smaller primes (fewer bits), or a different primitive like ECDSA might have differently.

  3. TimoshN commented on Oct 18, 2024

    @TimoshN

    in 32bit system

    produce incorrect BIGINT value set in
    ffi.NativeFunction<ffi.Int Function(ffi.Pointer<BIGNUM>, BN_ULONG)>>(

    as a temporary fix you may change typedef BN_ULONG = ffi.Uint64; to ffi.UnsignedLong

  4. EricApostal commented on Apr 8, 2025

    @EricApostal

    Has there been any attempts to fix this? I am currently running the following on a Galaxy Watch 2. This works completely fine on a Google Pixel 9, Fedora Linux desktop, and a Windows desktop.

    await RsaOaepPrivateKey.generateKey(
          2048,
          BigInt.from(65537),
          Hash.sha256,
        );

    It works fine on all devices except the Galaxy Watch 2, citing the exact same TOO_MANY_ITERATIONS error.

  5. microcrit commented on Apr 15, 2025

    @microcrit

    To add to @EricApostal - this continues to the Galaxy Watch Ultra as well. Likely an issue with all Wear OS or embedded devices.
    GWU Wear OS 5.0, System Version 14

  6. harrshita123 commented on Oct 17, 2026

    @harrshita123
    Contributor

    Update: #432 is now merged. It fixes the native ARM32 BN_ULONG binding used by BN_set_word, which could corrupt the RSA public exponent on 32-bit devices.

    The fix was validated through the example app on a Galaxy A10, API 29 (armeabi-v7a): ffi.sizeOf<ffi.UintPtr>() == 4, the exponent 65537 produced the expected BIGNUM bytes, and 2048-bit RSA-OAEP generation succeeded with public JWK exponent AQAB.

    This does not yet confirm whether the reported TOO_MANY_ITERATIONS failure on Android TV or Wear OS is resolved.

    If the failure still reproduces, it may includes:

    • package version or commit,
    • debug or release build,
    • device model, OS/API level, and ABI,
    • the RSA generation call and complete error output,
    • whether repeated attempts consistently fail.

    That evidence will determine whether the remaining failure is a separate BoringSSL or platform-specific issue.

  7. harrshita123 commented on Oct 17, 2026

    @harrshita123
    Contributor

    Follow-up: #445 separates the 2048-bit RSA-OAEP / exponent 65537 integration test from the Android ARM32-only BN_set_word ABI test added in #432.

    The new test can run on every Android ABI, including Android TV and Wear OS targets, without treating the ARM32-specific ABI assertion as a prerequisite. It is intended to reproduce and capture the remaining TOO_MANY_ITERATIONS behavior on an affected device. It does not claim to resolve that platform-specific failure.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions