Skip to content

Commit

Permalink
crypto: dh - constify struct dh's pointer members
Browse files Browse the repository at this point in the history
struct dh contains several pointer members corresponding to DH parameters:
->key, ->p and ->g. A subsequent commit will introduce "dh" wrapping
templates of the form "ffdhe2048(dh)", "ffdhe3072(dh)" and so on in order
to provide built-in support for the well-known safe-prime ffdhe group
parameters specified in RFC 7919. These templates will need to set the
group parameter related members of the (serialized) struct dh instance
passed to the inner "dh" kpp_alg instance, i.e. ->p and ->g, to some
constant, static storage arrays.

Turn the struct dh pointer members' types into "pointer to const" in
preparation for this.

Signed-off-by: Nicolai Stange <nstange@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Nicolai Stange authored and Herbert Xu committed Mar 2, 2022
1 parent 48c6d8b commit 215bebc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions include/crypto/dh.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
* @g_size: Size of DH generator G
*/
struct dh {
void *key;
void *p;
void *g;
const void *key;
const void *p;
const void *g;
unsigned int key_size;
unsigned int p_size;
unsigned int g_size;
Expand Down
2 changes: 1 addition & 1 deletion security/keys/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <keys/user-type.h>
#include "internal.h"

static ssize_t dh_data_from_key(key_serial_t keyid, void **data)
static ssize_t dh_data_from_key(key_serial_t keyid, const void **data)
{
struct key *key;
key_ref_t key_ref;
Expand Down

0 comments on commit 215bebc

Please sign in to comment.