Skip to content

Commit

Permalink
crypto: ccp - Fix sample application signature passing
Browse files Browse the repository at this point in the history
When parameters are sent the PSP returns back it's own signature
for the application to verify the authenticity of the result.

Display this signature to the caller instead of the one the caller
sent.

Fixes: f40d42f ("crypto: ccp - Add a sample python script for Dynamic Boost Control")
Fixes: febe3ed ("crypto: ccp - Add a sample library for ioctl use")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Mario Limonciello authored and Herbert Xu committed Sep 15, 2023
1 parent 70f242c commit 2ad01eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions tools/crypto/ccp/dbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ int process_param(int fd, int msg_index, __u8 *signature, int *data)
return errno;

*data = tmp.param;
memcpy(signature, tmp.signature, sizeof(tmp.signature));
return 0;
}
5 changes: 3 additions & 2 deletions tools/crypto/ccp/dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def process_param(device, message, signature, data=None):
if type(message) != tuple:
raise ValueError("Expected message tuple")
arg = ctypes.c_int(data if data else 0)
ret = lib.process_param(device.fileno(), message[0], signature, ctypes.pointer(arg))
sig = ctypes.create_string_buffer(signature, len(signature))
ret = lib.process_param(device.fileno(), message[0], ctypes.pointer(sig), ctypes.pointer(arg))
if ret:
handle_error(ret)
return arg, signature
return arg.value, sig.value

0 comments on commit 2ad01eb

Please sign in to comment.