From 9a44a928ccebdceb5a4dd9a4d67168cc04d1227f Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 28 Sep 2024 01:10:13 -0400 Subject: ostp.d: auth: Add user authentication Signed-off-by: Ian Moffett --- lib/include/defs.h | 4 ++++ lib/include/net/stpsession.h | 13 +++++++++++++ 2 files changed, 17 insertions(+) (limited to 'lib/include') diff --git a/lib/include/defs.h b/lib/include/defs.h index 1a022f9..e621e71 100644 --- a/lib/include/defs.h +++ b/lib/include/defs.h @@ -49,6 +49,10 @@ #define PAP_BAD_PERMS 0x02 /* SPW provided needs more permissions */ #define PAP_RESOURCE 0x03 /* Server has insufficient resources */ +/* Session auth code defs */ +#define AUTH_SUCCESS 0x00 /* Successful auth */ +#define AUTH_BAD_PW 0x01 /* Bad password */ + /* Fixed paths */ #define OSMORA_TRUST "/etc/ostp/trusted_users.osmt" diff --git a/lib/include/net/stpsession.h b/lib/include/net/stpsession.h index 773d57b..aeed9cb 100644 --- a/lib/include/net/stpsession.h +++ b/lib/include/net/stpsession.h @@ -41,6 +41,9 @@ */ #define MESSAGE_SIZE (1 << 12) +/* Session Request option bits */ +#define SESSION_REQ_USER BIT(0) + /* * The Session Request is sent from the client to the * server and contains a HOP (hash, options, pubkey) @@ -80,6 +83,16 @@ struct session_request { uint8_t pad[8]; } PACKED; +/* + * Structure containing user information + * for password protected channels. + */ +struct session_auth { + char username[256]; + char password[64]; + uint8_t code; +}; + /* * OSTP Message Frame containing an IV, AES * GCM tag, payload length and payload -- cgit v1.2.3