| | |
| | | #include <paths.h> |
| | | #define _GNU_SOURCE /* To get defns of NI_MAXSERV and NI_MAXHOST */ |
| | | #include <arpa/inet.h> |
| | | #include <sys/socket.h> |
| | | #include <netdb.h> |
| | | #include <ifaddrs.h> |
| | | #include <stdio.h> |
| | | #include <stdlib.h> |
| | | #include <unistd.h> |
| | | #include <linux/if_link.h> |
| | | #include <sys/socket.h> |
| | | #include <netpacket/packet.h> |
| | | |
| | | #include <paths.h> |
| | | |
| | | #include <stdlib.h> |
| | | #include <cstring> |
| | | #include <string> |
| | |
| | | #include <sstream> |
| | | #include <sys/ioctl.h> |
| | | #include <sys/stat.h> |
| | | #include "../os.hpp" |
| | | #include "../os-cpp.h" |
| | | #include "../../base/public-key.h" |
| | | |
| | | #include <openssl/evp.h> |
| | | #include <openssl/bio.h> |
| | | #include <openssl/pem.h> |
| | |
| | | namespace license { |
| | | |
| | | using namespace std; |
| | | |
| | | vector<AdapterInfo> OsFunctions::getAdapterInfos() { |
| | | return vector<AdapterInfo>(); |
| | | } |
| | | vector<DiskInfo> OsFunctions::getDiskInfos() { |
| | | struct stat filename_stat, mount_stat; |
| | | static char discard[1024]; |
| | | char device[64], name[64], type[64]; |
| | | FILE *mounts = fopen(_PATH_MOUNTED, "r"); |
| | | |
| | | while (fscanf(mounts, "%64s %64s %64s %1024[^\n]", device, name, type, |
| | | discard) != EOF) { |
| | | if (stat(device, &mount_stat) != 0) |
| | | continue; |
| | | if (filename_stat.st_dev == mount_stat.st_rdev) |
| | | fprintf(stderr, "device: %s; name: %s; type: %s\n", device, name, |
| | | type); |
| | | } |
| | | |
| | | return vector<DiskInfo>(); |
| | | } |
| | | |
| | | string OsFunctions::getModuleName() { |
| | | char path[2048] = { 0 }; |
| | |
| | | return result; |
| | | } |
| | | |
| | | string OsFunctions::getUserHomePath() { |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | bool OsFunctions::verifySignature(const char* stringToVerify, |
| | | const char* signatureB64) { |
| | |
| | | throw new logic_error("Error initializing digest"); |
| | | } |
| | | int en=strlen(stringToVerify); |
| | | if (1 |
| | | != EVP_DigestVerifyUpdate(mdctx, stringToVerify, |
| | | en)) { |
| | | if (1 != EVP_DigestVerifyUpdate(mdctx, stringToVerify, en)) { |
| | | throw new logic_error("Error verifying digest"); |
| | | } |
| | | bool result; |
| | |
| | | return result; |
| | | } |
| | | |
| | | void OsFunctions::initialize() { |
| | | static bool initialized = false; |
| | | if (!initialized) { |
| | | initialized = true; |
| | | ERR_load_ERR_strings(); |
| | | ERR_load_crypto_strings(); |
| | | OpenSSL_add_all_algorithms(); |
| | | } |
| | | } |
| | | |
| | | VIRTUALIZATION OsFunctions::getVirtualization() { |
| | | |
| | | VIRTUALIZATION getVirtualization() { |
| | | //http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html |
| | | // |
| | | bool rc = true; |
| | | //bool rc = true; |
| | | /*__asm__ ( |
| | | "push %edx\n" |
| | | "push %ecx\n" |