Skip to content

Commit 215bebc

Browse files
nicstangeherbertx
authored andcommitted
crypto: dh - constify struct dh's pointer members
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 <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 48c6d8b commit 215bebc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/crypto/dh.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
* @g_size: Size of DH generator G
3131
*/
3232
struct dh {
33-
void *key;
34-
void *p;
35-
void *g;
33+
const void *key;
34+
const void *p;
35+
const void *g;
3636
unsigned int key_size;
3737
unsigned int p_size;
3838
unsigned int g_size;

security/keys/dh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <keys/user-type.h>
1616
#include "internal.h"
1717

18-
static ssize_t dh_data_from_key(key_serial_t keyid, void **data)
18+
static ssize_t dh_data_from_key(key_serial_t keyid, const void **data)
1919
{
2020
struct key *key;
2121
key_ref_t key_ref;

0 commit comments

Comments
 (0)