1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2022 Felix Fietkau <nbd@nbd.name>
10 #include <libubox/utils.h>
13 #include "curve25519.h"
15 #define UNET_AUTH_MAGIC 0x754e6574
17 struct unet_auth_hdr
{
23 uint8_t signature
[EDSIGN_SIGNATURE_SIZE
];
26 struct unet_auth_data
{
28 uint8_t pubkey
[CURVE25519_KEY_SIZE
];
32 int unet_auth_data_validate(const uint8_t *key
, const void *buf
, size_t len
,
33 uint64_t *timestamp
, const char **json_data
);
35 static inline const struct unet_auth_data
*
36 net_data_auth_data_hdr(const void *net_data
)
38 return net_data
+ sizeof(struct unet_auth_hdr
);