-
- if (auth_data.len != my_auth_data.len)
- {
- chunk_free(&my_auth_data);
- status = FAILED;
- }
- else if (memcmp(auth_data.ptr,my_auth_data.ptr, my_auth_data.len) == 0)
- {
- this->logger->log(this->logger, CONTROL, "authentication of '%s' with pre-shared key successful",
- other_id->get_string(other_id));
- status = SUCCESS;
- }
- else
- {
- this->logger->log(this->logger, ERROR, "authentication of '%s' with pre-shared key failed",
- other_id->get_string(other_id));
- status = FAILED;
- }
+
+ status = (auth_data.len == my_auth_data.len && memeq(auth_data.ptr, my_auth_data.ptr, my_auth_data.len))
+ ? SUCCESS : FAILED;