YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
AuthHMAC.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2010 Daniel Krieg <krieg@fias.uni-frankfurt.de>
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_IMPL_AUTHHMAC_H
8#define YARP_OS_IMPL_AUTHHMAC_H
9
10#include <yarp/os/InputStream.h>
12
13#include <hmac_sha2.h>
14
15#define DIGEST_SIZE SHA256_DIGEST_SIZE
16#define HMAC_CONTEXT hmac_sha256_ctx
17#define HMAC_INIT hmac_sha256_init
18#define HMAC_REINIT hmac_sha256_reinit
19#define HMAC_UPDATE hmac_sha256_update
20#define HMAC_FINAL hmac_sha256_final
21#define NONCE_LEN 8
22
23namespace yarp::os::impl {
24
29{
30public:
34 AuthHMAC();
35
39 virtual ~AuthHMAC() = default;
40
43
44private:
45 static bool send_hmac(yarp::os::OutputStream* stream, unsigned char* nonce, unsigned char* mac);
46 static bool receive_hmac(yarp::os::InputStream* stream, unsigned char* nonce, unsigned char* mac);
47 static bool check_hmac(unsigned char* mac, unsigned char* mac_check);
48 static void fill_nonce(unsigned char* nonce);
49
50 bool authentication_enabled;
51 HMAC_CONTEXT context;
52};
53
54} // namespace yarp::os::impl
55
56#endif // YARP_OS_IMPL_AUTHHMAC_H
#define HMAC_CONTEXT
Definition AuthHMAC.h:16
A mini-server for performing network communication in the background.
Simple specification of the minimum functions needed from input streams.
Definition InputStream.h:25
Simple specification of the minimum functions needed from output streams.
3-way authentication via HMAC
Definition AuthHMAC.h:29
virtual ~AuthHMAC()=default
Destructor.
The components from which ports and connections are built.
#define YARP_os_impl_API
Definition api.h:46