Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
system_security
Commits
07b0cda3
Commit
07b0cda3
authored
10 years ago
by
Chad Brubaker
Browse files
Options
Download
Email Patches
Plain Diff
Implement keymaster 1.0 export_key method
Change-Id: I2a87cb61c340a099cc98d1a2db9e7390fb001b5d
parent
4c353cb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
keystore/keystore.cpp
keystore/keystore.cpp
+29
-4
No files found.
keystore/keystore.cpp
View file @
07b0cda3
...
...
@@ -2639,10 +2639,35 @@ public:
return
mKeyStore
->
put
(
filename
.
string
(),
&
keyBlob
,
uid
);
}
void
exportKey
(
const
String16
&
/*name*/
,
keymaster_key_format_t
/*format*/
,
const
keymaster_blob_t
&
/*clientId*/
,
const
keymaster_blob_t
&
/*appData*/
,
ExportResult
*
result
)
{
result
->
resultCode
=
KM_ERROR_UNIMPLEMENTED
;
void
exportKey
(
const
String16
&
name
,
keymaster_key_format_t
format
,
const
keymaster_blob_t
&
clientId
,
const
keymaster_blob_t
&
appData
,
ExportResult
*
result
)
{
uid_t
callingUid
=
IPCThreadState
::
self
()
->
getCallingUid
();
Blob
keyBlob
;
String8
name8
(
name
);
int
rc
;
ResponseCode
responseCode
=
mKeyStore
->
getKeyForName
(
&
keyBlob
,
name8
,
callingUid
,
TYPE_KEYMASTER_10
);
if
(
responseCode
!=
::
NO_ERROR
)
{
result
->
resultCode
=
responseCode
;
return
;
}
keymaster_key_blob_t
key
;
key
.
key_material_size
=
keyBlob
.
getLength
();
key
.
key_material
=
keyBlob
.
getValue
();
keymaster1_device_t
*
dev
=
mKeyStore
->
getDeviceForBlob
(
keyBlob
);
if
(
!
dev
->
export_key
)
{
result
->
resultCode
=
KM_ERROR_UNIMPLEMENTED
;
return
;
}
uint8_t
*
ptr
=
NULL
;
rc
=
dev
->
export_key
(
dev
,
format
,
&
key
,
&
clientId
,
&
appData
,
&
ptr
,
&
result
->
dataLength
);
result
->
exportData
.
reset
(
ptr
);
result
->
resultCode
=
rc
?
rc
:
::
NO_ERROR
;
}
void
begin
(
const
sp
<
IBinder
>&
/*appToken*/
,
const
String16
&
/*name*/
,
...
...
This diff is collapsed.
Click to expand it.
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