Skip to content

TKey sign-if-logged library upstreaming

Nisse's requests to the Tillitis folks regarding TKey library upstreaming:

  • Add division support
  • Fix weird link alignment issue
  • Fix missing std library headers. The prototype workarounds are:
    • <assert.h> (there's a related <tkey/assert.h>, almost conforming to C standards)
    • <ctype.h>, where I depend only on isspace, C locale only.
    • <stdio.h>. Not sure what makes sense to add for tkey-libs; what I do to avoid compile errors in nettle is that I define FILE as an empty struct, stderr as NULL, and dummy functions fprintf and fwrite that do nothing and always return failure.
    • <stdlib.h>, where I need abort() (which could be mapped to tkey assert_halt), alloca (non-standard, but could be defined using __builtin_alloca). And I have dummy implementations of malloc, realloc and free, where the first two always return NULL.
    • <string.h>, where I need strcmp, memcmp, memchr, possibly also strspn/strcspn and memmove.
    • <time.h>, type time_t, function time. I think this dependency goes away with nettle-4, where I delete soem obsolete openpgp code. But I think it still makes sense to at least provide a time.h header defining a (64-bit) time_t.
    • See also: https://github.com/tillitis/tkey-libs/issues/75
    • Nisse comment: I guess it can be debated which of these really make sense in tkey-libs, but if those that do make sense are added, that makes it easier to build supposedly portable library code for the tkey.

Nisse is happy to discuss in more detail with MC / Tillitis to resolve any ambiguities in the above sketch, e.g., via email or on IRC/Matrix.

(If helpful, such discussion may result in this description being updated or more Tillitis issues being filed at GitHub.)

Edited by Rasmus Dahlberg