Re-work OID handling #362
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#362
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up of OID handling of #309
FYI: During my work on a support for encrypted pkcs8 ecc keys the OID stuff became even more complicated see https://github.com/libtom/libtomcrypt/blob/pr/ecc-asn1-part/src/pk/ecc/ecc_import_pkcs8.c
I know that the current way the API is built up works pretty well, but there is one basic thing I don't like and that's the usage of
unsigned longto represent an OID arc which would basically result in different en-/decoding capabilities of the implementation depending on the architecture if the code wouldn't trim it all down to 32bits...This leads to the following questions:
Should we keep the basic type of the OID array as
unsigned longor change it toulong32orulong64(and kill the trimming)?Or do we even want 100% ASN.1 standard compatibility? Then we'd have to work with
mp_intto represent an arc... where one implementation would then be to only work with strings/const char*on the API and usemp_inton the insides... or do we really have to convert OID's into their numerical representation? Why can't we even work with strings on the inside and do the conversion when doing the ASN.1 en/decoding on the fly via the math provider?When reading http://oid-info.com/faq.htm#size-limitations I'd say it'd be sufficient to change the basic type to
ulong64and optionally provide something likeder_encode_object_identifier_64()etc.The biggest problem then being the break of user-code when processing flexi-decoded OID's ...
[Edit]: I've just received an answer from the oid-info.com admins:
I'll just leave this here...
The more I fiddle with OID stuff the more I think that our API (public functions, public structs) shoudl use string representation e.g.
"1.2345.67.8.9.10". I see the API breakage of flexi-decoded OID's but I still consider using strings more appropriate.Perfect, then I'll work in that direction!
Regarding the API breakage we could leave the old enum element
LTC_ASN1_OBJECT_IDENTIFIERin there but don't use it anymore on output, but still process it on input? And then simply add a newLTC_ASN1_OID_STRING?Or we replace the first by the latter?
It'd come together with a major ABI bump, so I tend to replace, but don't use the old name.
I would:
LTC_ASN1_OBJECT_IDENTIFIER(we use it quite a lot even in libtomcrypt itself)LTC_ASN1_OID_STRINGLTC_ASN1_OID_STRINGsounds good!
I'm thinking about defaulting to only decode to
LTC_ASN1_OID_STRINGand if s/o requests aLTC_ASN1_OBJECT_IDENTIFIERto convert.The advantage would be:
I've also pushed a starting point to the branch rework/oid that removes
oid_st. Should I already open a PR for that?Yes, I am for opening a new PR so that we see what Travis-CI thinks about the changes.
Ad: only decode to LTC_ASN1_OID_STRING 👍