Builtin authentication plugin for DDS Security
Builtin authentication plugin of DDS Security implementation was added. This plugin is the first implementation and it also contains the functions that are used initially in the secure communication sequence. The builtin authentication plugin implements authentication using a trusted Certificate Authority (CA). It performs mutual authentication between discovered participants using the RSA or ECDSA Digital Signature Algorithms and establishes a shared secret using Diffie-Hellman (DH) or Elliptic Curve Diffie-Hellman (ECDH) Key Agreement Methods. DDS Security core component is introduced with this commit. DDSI and other builtin plugins will also use the security core. Like all builtin plugins, dds security authentication plugin is a shared library for providing dynamic library loading on runtime. So that, dds participants can use different plugin implementations with different configurations. Authentication plugin uses ddsrt functions. ddsrt is not expected to be a shared library and statically adding ddsrt objects to authentication library produces linkage errors in windows. So, dynamically linking authentication plugin to ddc library is decided. Another decision should be taken for the platforms that are not supporting dynamic libraries later. Signed-off-by: Kurtulus Oksuztepe <kurtulus.oksuztepe@adlinktech.com>
This commit is contained in:
parent
aa3b95ee7f
commit
2c1d3010d0
109 changed files with 20998 additions and 66 deletions
|
@ -59,6 +59,9 @@ typedef int64_t dds_duration_t;
|
|||
/** @name Infinite timeout for relative time */
|
||||
#define DDS_INFINITY ((dds_duration_t) INT64_MAX)
|
||||
|
||||
/** @name Invalid time value for assigning to time output when something goes wrong */
|
||||
#define DDS_TIME_INVALID ((dds_time_t) INT64_MIN)
|
||||
|
||||
/** @name Macro definition for time conversion to nanoseconds
|
||||
@{**/
|
||||
#define DDS_SECS(n) ((n) * DDS_NSECS_IN_SEC)
|
||||
|
|
|
@ -18,78 +18,78 @@
|
|||
#include "dds/ddsrt/io.h"
|
||||
|
||||
dds_return_t ddsrt_dlopen(const char *name, bool translate,
|
||||
ddsrt_dynlib_t *handle) {
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
ddsrt_dynlib_t *handle) {
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
|
||||
assert( handle );
|
||||
*handle = NULL;
|
||||
assert( handle );
|
||||
*handle = NULL;
|
||||
|
||||
if ((translate) && (strrchr(name, '/') == NULL )) {
|
||||
/* Add lib and suffix to the name and try to open. */
|
||||
if ((translate) && (strrchr(name, '/') == NULL )) {
|
||||
/* Add lib and suffix to the name and try to open. */
|
||||
#if __APPLE__
|
||||
static const char suffix[] = ".dylib";
|
||||
static const char suffix[] = ".dylib";
|
||||
#else
|
||||
static const char suffix[] = ".so";
|
||||
static const char suffix[] = ".so";
|
||||
#endif
|
||||
char* libName;
|
||||
ddsrt_asprintf( &libName, "lib%s%s", name, suffix);
|
||||
*handle = dlopen(libName, RTLD_GLOBAL | RTLD_NOW);
|
||||
ddsrt_free(libName);
|
||||
}
|
||||
char* libName;
|
||||
ddsrt_asprintf( &libName, "lib%s%s", name, suffix);
|
||||
*handle = dlopen(libName, RTLD_GLOBAL | RTLD_NOW);
|
||||
ddsrt_free(libName);
|
||||
}
|
||||
|
||||
if (*handle == NULL ) {
|
||||
/* name contains a path,
|
||||
* (auto)translate is disabled or
|
||||
* dlopen on translated name failed. */
|
||||
*handle = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
|
||||
}
|
||||
if (*handle == NULL ) {
|
||||
/* name contains a path,
|
||||
* (auto)translate is disabled or
|
||||
* dlopen on translated name failed. */
|
||||
*handle = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
|
||||
}
|
||||
|
||||
if (*handle != NULL) {
|
||||
retcode = DDS_RETCODE_OK;
|
||||
} else {
|
||||
retcode = DDS_RETCODE_ERROR;
|
||||
}
|
||||
if (*handle != NULL) {
|
||||
retcode = DDS_RETCODE_OK;
|
||||
} else {
|
||||
retcode = DDS_RETCODE_ERROR;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
return retcode;
|
||||
}
|
||||
|
||||
dds_return_t ddsrt_dlclose(ddsrt_dynlib_t handle) {
|
||||
|
||||
assert ( handle );
|
||||
return (dlclose(handle) == 0) ? DDS_RETCODE_OK : DDS_RETCODE_ERROR;
|
||||
assert ( handle );
|
||||
return (dlclose(handle) == 0) ? DDS_RETCODE_OK : DDS_RETCODE_ERROR;
|
||||
|
||||
}
|
||||
|
||||
dds_return_t ddsrt_dlsym(ddsrt_dynlib_t handle, const char *symbol,
|
||||
void **address) {
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
void **address) {
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
|
||||
assert( handle );
|
||||
assert( address );
|
||||
assert( symbol );
|
||||
assert( handle );
|
||||
assert( address );
|
||||
assert( symbol );
|
||||
|
||||
*address = dlsym(handle, symbol);
|
||||
if (*address == NULL) {
|
||||
retcode = DDS_RETCODE_ERROR;
|
||||
}
|
||||
*address = dlsym(handle, symbol);
|
||||
if (*address == NULL) {
|
||||
retcode = DDS_RETCODE_ERROR;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
return retcode;
|
||||
}
|
||||
|
||||
dds_return_t ddsrt_dlerror(char *buf, size_t buflen) {
|
||||
|
||||
const char *err;
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
const char *err;
|
||||
dds_return_t retcode = DDS_RETCODE_OK;
|
||||
|
||||
assert (buf );
|
||||
assert (buf );
|
||||
|
||||
err = dlerror();
|
||||
if (err == NULL) {
|
||||
retcode = DDS_RETCODE_NOT_FOUND;
|
||||
} else {
|
||||
snprintf(buf, buflen, "%s", err);
|
||||
}
|
||||
err = dlerror();
|
||||
if (err == NULL) {
|
||||
retcode = DDS_RETCODE_NOT_FOUND;
|
||||
} else {
|
||||
snprintf(buf, buflen, "%s", err);
|
||||
}
|
||||
|
||||
return retcode;
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ dds_return_t ddsrt_dlerror(char *buf, size_t buflen) {
|
|||
if ( err == 0 ) {
|
||||
retcode = DDS_RETCODE_NOT_FOUND;
|
||||
} else {
|
||||
retcode = ddsrt_strerror_r(err, buf, buflen);
|
||||
ddsrt_strerror_r(err, buf, buflen);
|
||||
SetLastError(0);
|
||||
}
|
||||
|
||||
return retcode;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue