Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
apk-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sertonix
apk-tools
Commits
727ecc44
Commit
727ecc44
authored
3 years ago
by
Timo Teräs
Browse files
Options
Downloads
Patches
Plain Diff
verify: support v3 packages
parent
d3e71bb4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/extract_v2.c
+1
-1
1 addition, 1 deletion
src/extract_v2.c
src/extract_v3.c
+23
-3
23 additions, 3 deletions
src/extract_v3.c
with
24 additions
and
4 deletions
src/extract_v2.c
+
1
−
1
View file @
727ecc44
...
...
@@ -356,7 +356,7 @@ int apk_extract_v2(struct apk_extract_ctx *ectx, struct apk_istream *is)
apk_istream_gunzip_mpart
(
is
,
apk_sign_ctx_mpart_cb
,
&
sctx
),
apk_extract_v2_entry
,
ectx
,
apk_ctx_get_id_cache
(
ac
));
if
(
r
==
-
ECANCELED
)
r
=
0
;
if
(
r
==
0
&&
!
ectx
->
is_package
&&
!
ectx
->
is_index
)
if
(
(
r
==
0
||
r
==
-
APKE_SIGNATURE_UNTRUSTED
||
r
==
-
APKE_EOF
)
&&
!
ectx
->
is_package
&&
!
ectx
->
is_index
)
r
=
ectx
->
ops
->
v2index
?
-
APKE_V2NDX_FORMAT
:
-
APKE_V2PKG_FORMAT
;
if
(
ectx
->
generate_identity
)
*
ectx
->
identity
=
sctx
.
identity
;
apk_sign_ctx_free
(
&
sctx
);
...
...
This diff is collapsed.
Click to expand it.
src/extract_v3.c
+
23
−
3
View file @
727ecc44
...
...
@@ -188,6 +188,25 @@ static int apk_extract_v3_data_block(struct adb *db, struct adb_block *b, struct
return
apk_extract_v3_file
(
ectx
,
sz
,
is
);
}
static
int
apk_extract_v3_verify_meta
(
struct
apk_extract_ctx
*
ectx
,
struct
adb
*
db
)
{
return
0
;
}
static
int
apk_extract_v3_verify_file
(
struct
apk_extract_ctx
*
ectx
,
const
struct
apk_file_info
*
fi
,
struct
apk_istream
*
is
)
{
if
(
is
)
{
apk_istream_read
(
is
,
0
,
fi
->
size
);
return
apk_istream_close
(
is
);
}
return
0
;
}
static
const
struct
apk_extract_ops
extract_v3verify_ops
=
{
.
v3meta
=
apk_extract_v3_verify_meta
,
.
file
=
apk_extract_v3_verify_file
,
};
int
apk_extract_v3
(
struct
apk_extract_ctx
*
ectx
,
struct
apk_istream
*
is
)
{
struct
apk_ctx
*
ac
=
ectx
->
ac
;
...
...
@@ -198,8 +217,8 @@ int apk_extract_v3(struct apk_extract_ctx *ectx, struct apk_istream *is)
int
r
;
if
(
IS_ERR
(
is
))
return
PTR_ERR
(
is
);
if
(
!
ectx
->
ops
||
!
ectx
->
ops
->
v3meta
)
return
apk_istream_close_error
(
is
,
-
APKE_FORMAT_NOT_SUPPORTED
);
if
(
!
ectx
->
ops
)
ectx
->
ops
=
&
extract_v3verify_ops
;
if
(
!
ectx
->
ops
->
v3meta
)
return
apk_istream_close_error
(
is
,
-
APKE_FORMAT_NOT_SUPPORTED
);
ectx
->
pctx
=
&
ctx
;
r
=
adb_m_process
(
&
ctx
.
db
,
adb_decompress
(
is
,
0
),
...
...
@@ -211,6 +230,7 @@ int apk_extract_v3(struct apk_extract_ctx *ectx, struct apk_istream *is)
}
if
(
r
==
-
ECANCELED
)
r
=
0
;
adb_free
(
&
ctx
.
db
);
ectx
->
pctx
=
0
;
apk_extract_reset
(
ectx
);
return
r
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment