Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
signlk
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Linaro
landing-teams
qcomlt
migration
signlk
Commits
da75e0a8
Commit
da75e0a8
authored
6 years ago
by
Nico Dechesne (Stage)
Browse files
Options
Downloads
Patches
Plain Diff
signlk.sh: fix indentation and style
Signed-off-by:
Nicolas Dechesne
<
nicolas.dechesne@linaro.org
>
parent
16af7d46
Branches
64bit
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
signlk.sh
+51
-53
51 additions, 53 deletions
signlk.sh
with
51 additions
and
53 deletions
signlk.sh
+
51
−
53
View file @
da75e0a8
...
...
@@ -39,73 +39,71 @@ OU=""
set
-e
for
i
in
"
$@
"
do
case
$i
in
-i
=
*
|
--in
=
*
)
INFILE
=
"
${
i
#*=
}
"
;;
-o
=
*
|
--out
=
*
)
OUTFILE
=
"
${
i
#*=
}
"
;;
-OU
=
*
|
-ou
=
*
)
OU
=
"
${
i
#*=
}
"
;;
-CN
=
*
|
-cn
=
*
)
CN
=
"
${
i
#*=
}
"
;;
--tmpdir
=
*
)
tmpdir
=
"
${
i
#*=
}
"
mkdir
-p
$tmpdir
NOCLEAN
=
1
;;
-d
|
--debug
)
set
-x
NOCLEAN
=
1
;;
-h
*
|
--help
*
)
echo
"signlk -i=input_file_name [-o=output_file_name]"
echo
"-i input ELF/MBN file name"
echo
"-o output file name, input_file_name with suffix of 'signed' as default "
echo
"-cn common name "
echo
"-ou organization unit "
echo
"--tmpdir specify tmp folder to use"
exit
0
;;
*
)
echo
"unsupported option"
# unknown option
echo
"type signlk --help for help"
exit
1
;;
esac
for
i
in
"
$@
"
;
do
case
$i
in
-i
=
*
|
--in
=
*
)
INFILE
=
"
${
i
#*=
}
"
;;
-o
=
*
|
--out
=
*
)
OUTFILE
=
"
${
i
#*=
}
"
;;
-OU
=
*
|
-ou
=
*
)
OU
=
"
${
i
#*=
}
"
;;
-CN
=
*
|
-cn
=
*
)
CN
=
"
${
i
#*=
}
"
;;
--tmpdir
=
*
)
tmpdir
=
"
${
i
#*=
}
"
mkdir
-p
$tmpdir
NOCLEAN
=
1
;;
-d
|
--debug
)
set
-x
NOCLEAN
=
1
;;
-h
*
|
--help
*
)
echo
"signlk -i=input_file_name [-o=output_file_name]"
echo
"-i input ELF/MBN file name"
echo
"-o output file name, input_file_name with suffix of 'signed' as default "
echo
"-cn common name "
echo
"-ou organization unit "
echo
"--tmpdir specify tmp folder to use"
exit
0
;;
*
)
echo
"unsupported option"
# unknown option
echo
"type signlk --help for help"
exit
1
;;
esac
done
if
[
"
$INFILE
"
=
""
]
;
then
echo
"signlk -i=input_file_name [-o=output_file_name]"
exit
2
echo
"signlk -i=input_file_name [-o=output_file_name]"
exit
2
fi
INFILE_filename
=
$(
echo
$INFILE
| rev |
cut
-f
2-
-d
'.'
| rev
)
if
[
"
$OUTFILE
"
=
""
]
;
then
OUTFILE
=
$INFILE_filename
"_signed.mbn"
OUTFILE
=
$INFILE_filename
"_signed.mbn"
fi
echo
"generating output file
$OUTFILE
"
[
-z
$tmpdir
]
&&
tmpdir
=
$(
mktemp
-d
)
TMPOUTFILE
=
$tmpdir
/
"tmp.elf"
if
[
!
"
$(
openssl version
)
"
]
;
then
echo
"please install openssl"
exit
6
echo
"please install openssl"
exit
6
fi
if
[
!
"
$(
make
-v
)
"
]
;
then
echo
"please install gcc"
exit
7
echo
"please install gcc"
exit
7
fi
if
[
!
"
$(
g++
--version
)
"
]
;
then
echo
"please install g++"
exit
8
echo
"please install g++"
exit
8
fi
make
-C
$DIR
/signer
...
...
@@ -121,15 +119,15 @@ openssl sha256 -binary $tmpdir/header > $tmpdir/data
cat
$tmpdir
/hash>>
$tmpdir
/data
for
f
in
$tmpdir
/segment
*
;
do
openssl sha256
-binary
$f
>>
$tmpdir
/data
openssl sha256
-binary
$f
>>
$tmpdir
/data
done
openssl sha256
-binary
$tmpdir
/data
>
$tmpdir
/stp0
cat
$tmpdir
/Si
>
$tmpdir
/tmpDigest0
cat
$tmpdir
/stp0
>>
$tmpdir
/tmpDigest0
cat
$tmpdir
/stp0
>>
$tmpdir
/tmpDigest0
openssl sha256
-binary
$tmpdir
/tmpDigest0
>
$tmpdir
/stp1
cat
$tmpdir
/So
>
$tmpdir
/tmpDigest1
cat
$tmpdir
/stp1
>>
$tmpdir
/tmpDigest1
cat
$tmpdir
/stp1
>>
$tmpdir
/tmpDigest1
openssl sha256
-binary
$tmpdir
/tmpDigest1
>
$tmpdir
/dataToSign.bin
DATA
=
$tmpdir
/data
...
...
@@ -173,7 +171,7 @@ dd if=$TMPOUTFILE of=$OUTFILE bs=1 skip=$(($hash_seg_offset+$hash_seg_file_size)
# no cleanup in debug mode
if
[
-z
$NOCLEAN
]
;
then
echo
rm
-rf
$tmpdir
rm
-rf
$tmpdir
fi
echo
done
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