corpnewt / ProperTree

Cross platform GUI plist editor written in python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ProperTree can't accept 64 bit characters

PGBSean opened this issue · comments

commented

I can't recall this correctly if this is Python's fault or your's, but ProperTree can't format 64-bit characters properly if you want to insert the characters into somewhere useful like ApECID for Apple Secure Boot.

You can see the terminal output below:
image

If I paste this string of characters into ProperTree, for me this will be the ApECID field:
Screenshot 2023-10-20 at 22 26 31

ProperTree will show incorrect (not correctly formatted) integer into the field.

Changing value types does not have any effect on the bootloader.

Possible solutions

  • Trigger Python to accept 64-bit integer into ProperTree
  • Uplift the Python requirements (lame)
  • Find the other way around ig

In looking at your examples, the first is within the range of a signed 64-bit integer, and works just fine:
image

Your second value is beyond the range of signed 64-bit integers (-9223372036854775808 through 9223372036854775807). ProperTree is designed to roll any integers that are outside that signed 64-bit int range into <real> values, which are floating point numbers. This is to ensure it adheres to the property list specifications. The Dortania guide has you generate an unsigned 64-bit integer, which can have a maximum value of 18446744073709551615, and goes beyond what a signed 64-bit int can accommodate.

-CorpNewt

commented

If OpenCore allows signed values for ApECID (whether it interprets the bits as unsigned or however), you can adjust the terminal command to the following:

python3 -c 'import secrets; a = secrets.randbits(64); print(a-((a & 0x8000000000000000) << 1))'

This returns a signed 64-bit integer based on the random 64-bits generated by secrets.randbits(64).

If OpenCore does not allow signed values for ApECID, then you can use the original terminal command, but replace secrets.randbits(64) with secrets.randbits(63) to ensure it is always within the positive range of a signed 64-bit integer:

python3 -c 'import secrets; print(secrets.randbits(63))'

Either way - ProperTree is not at fault here, as it's doing exacty what it was designed to in order to adhere to the spec.

-CorpNewt