Commit Graph

6 Commits (0b7d6dfbf2c7e54171719f4a427789962d365642)

Author SHA1 Message Date
Aydin Mercan 0b7d6dfbf2
crypto: start seperating public/private key usage
Digests now use bearssl + libsodium instead of openssl + libsodium.
It fits better with the API looking more similar and I don't think it
will be that much of a bottleneck.

Instead of a apk_pkey that mimicks the EVP_PKEY semantics, have seperate
public and private key structures. However, apk is broken because of it
and needs fixing. The rest of the code might compile but won't work
as I haven't handled the cases where pkey corressponds to public/private
keys in codebase properly. Also, DSA signatures are removed.

Public and private keys impls' now use a static array of vtables
internally. The indicies correspond to the signature scheme version and
checking `< APK_*_MAX` should be enough? I tried to make so that higher
values correspond to more desirable constructs, this might come in handy.

Signing/verifying start is free from keys as it isn't used though it
might be brought back for domain seperated hashes, ability to get
timestamps involved with epheremal keys in the future etc.

`apk_crypto.h` is free from openssl includes although some headers still
use them for now.
2022-08-24 10:15:14 +03:00
Timo Teräs de281f0f83 extract_v2: handle "untrusted package" as normal error
The "untrusted" error is higher priority than malformed package.
But given that we expect valid .apk or index as argument, the
untrusted error is likely more accurate than having malformed
package.
2021-11-15 15:41:59 +02:00
Timo Teräs aa44cfac05 extract: fix extracting untrusted package 2021-08-03 21:21:43 +03:00
Timo Teräs 727ecc440c verify: support v3 packages 2021-07-30 18:06:34 +03:00
Timo Teräs 5843daf7a1 Further refactor extract API to have separate ops vtable
This splits the callbacks by type, and further prepares the API
to be usable for v3 files too.
2021-07-27 16:28:22 +03:00
Timo Teräs 9c843e4ecd Refactor .apk extraction code
This moves and isolates the tar code to tar.c. And the actual
file extraction to disk is moved to extract.c.

A new API is introduced and used for v2 file extraction. This
essentially moves and isolates the apk_sign_ctx_* beast into
extract_v2.c and offers a saner interface to handling packages.

A place holder is added for v3 extraction.
2021-07-27 14:09:38 +03:00