diff options
author | David Howells <dhowells@redhat.com> | 2020-05-12 16:03:53 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2020-06-02 19:22:31 +0300 |
commit | b6f61c31464940513ef4eccb3a030a405b4256d6 (patch) | |
tree | 96a2e83c12c0e7e2f4c1119461c55987165cb2e8 /security | |
parent | 521fd61c84a19b31dfbaa8dde3d2577e4e115d12 (diff) | |
download | linux-b6f61c31464940513ef4eccb3a030a405b4256d6.tar.xz |
keys: Implement update for the big_key type
Implement the ->update op for the big_key type.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'security')
-rw-r--r-- | security/keys/big_key.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/security/keys/big_key.c b/security/keys/big_key.c index d43f3daab2b8..dd708e8f13c0 100644 --- a/security/keys/big_key.c +++ b/security/keys/big_key.c @@ -47,7 +47,7 @@ struct key_type key_type_big_key = { .destroy = big_key_destroy, .describe = big_key_describe, .read = big_key_read, - /* no ->update(); don't add it without changing chacha20poly1305's nonce */ + .update = big_key_update, }; /* @@ -192,6 +192,23 @@ void big_key_destroy(struct key *key) } /* + * Update a big key + */ +int big_key_update(struct key *key, struct key_preparsed_payload *prep) +{ + int ret; + + ret = key_payload_reserve(key, prep->datalen); + if (ret < 0) + return ret; + + if (key_is_positive(key)) + big_key_destroy(key); + + return generic_key_instantiate(key, prep); +} + +/* * describe the big_key key */ void big_key_describe(const struct key *key, struct seq_file *m) |