Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
apk-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
60
Issues
60
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpine
apk-tools
Commits
09428323
Commit
09428323
authored
Jul 17, 2009
by
Timo Teräs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index: fix output file permissions, verify signed index (ref
#46
)
parent
65be7ade
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
src/index.c
src/index.c
+2
-2
src/package.c
src/package.c
+18
-7
No files found.
src/index.c
View file @
09428323
...
...
@@ -169,14 +169,14 @@ static int index_main(void *ctx, int argc, char **argv)
if
(
ictx
->
method
==
APK_SIGN_GENERATE
)
{
memset
(
&
fi
,
0
,
sizeof
(
fi
));
fi
.
name
=
"APKINDEX"
;
fi
.
mode
=
0
755
|
S_IFREG
;
fi
.
mode
=
0
644
|
S_IFREG
;
os
=
apk_ostream_counter
(
&
fi
.
size
);
apk_db_index_write
(
&
db
,
os
);
os
->
close
(
os
);
}
if
(
ictx
->
output
!=
NULL
)
os
=
apk_ostream_to_file
(
ictx
->
output
,
0
755
);
os
=
apk_ostream_to_file
(
ictx
->
output
,
0
644
);
else
os
=
apk_ostream_to_fd
(
STDOUT_FILENO
);
if
(
ictx
->
method
==
APK_SIGN_GENERATE
)
{
...
...
src/package.c
View file @
09428323
...
...
@@ -391,13 +391,24 @@ int apk_sign_ctx_mpart_cb(void *ctx, EVP_MD_CTX *mdctx, int part)
break
;
case
APK_MPART_END
:
if
(
sctx
->
action
==
APK_SIGN_VERIFY
)
{
/* Check that data checksum matches */
EVP_DigestFinal_ex
(
mdctx
,
calculated
,
NULL
);
if
(
sctx
->
has_data_checksum
&&
EVP_MD_CTX_size
(
mdctx
)
!=
0
&&
memcmp
(
calculated
,
sctx
->
data_checksum
,
EVP_MD_CTX_size
(
mdctx
))
==
0
)
sctx
->
data_verified
=
1
;
if
(
sctx
->
has_data_checksum
)
{
/* Check that data checksum matches */
EVP_DigestFinal_ex
(
mdctx
,
calculated
,
NULL
);
if
(
EVP_MD_CTX_size
(
mdctx
)
!=
0
&&
memcmp
(
calculated
,
sctx
->
data_checksum
,
EVP_MD_CTX_size
(
mdctx
))
==
0
)
sctx
->
data_verified
=
1
;
}
else
if
(
sctx
->
signature
.
pkey
!=
NULL
)
{
/* Assume that the data is fully signed */
r
=
EVP_VerifyFinal
(
mdctx
,
(
unsigned
char
*
)
sctx
->
signature
.
data
.
ptr
,
sctx
->
signature
.
data
.
len
,
sctx
->
signature
.
pkey
);
if
(
r
==
1
)
{
sctx
->
control_verified
=
1
;
sctx
->
data_verified
=
1
;
}
}
}
else
if
(
!
sctx
->
has_data_checksum
)
{
/* Package identity is checksum of all data */
sctx
->
identity
.
type
=
EVP_MD_CTX_size
(
mdctx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment