C, Linux

[libressl] Generate RSA key

In the latest version of libressl, RSA_generate_key is deprecated, RSA_generate_key_ex should be implemented instead. Implementation (updated) Source file (test.c)

  To compile and run the program, the library libcrypto should be imported

  Expected output

    Implementation (deprecated) Source file (test.c)

C, Linux

[libressl] Setup

SETUP Install the dependencies first

  Clone the repository from Github

  Prepare the source tree

  Configure the source tree and compile the libressl

  Install the libressl under ${HOME}/opt/libressl

  The following error will arise if the library is not written to linked library config file

  To avoid the above error

Continue Reading

Algorithms, C++

Breadth first search

Steps: Add root to queue If left child not null, add it to queue If right child not null, add it to queue Repeat 2 & 3 until the queue is empty

 

C, C++, Language

CMake command

Set variable Basic usage of SET

  To include existing variables in the SET

  To include multiple items in SET

  Include include path (header)   Suppose we have the header files like this

  To globally add the include path, use include_directories

  To specially add the include path for target, use target_include_directories

Continue Reading

C++

Google C++ style guide

Filenames should be all lowercase with underscores (_) or dashes (-) hello_world.cc   All types like classes, structs, type aliases, enums, and type should be capitalized. class Person   Variables should be all lowercase with underscores string table_name   Data member in the class (not struct) should contain a trailing underscores string var_in_class_   Use a struct only for passive objects that carry…

Continue Reading

C++

C++ 11

Auto type

  Auto type + Ranged-based for loop

  Initializer list

  Strongly-typed enum

  Compile time assert

 

Gatekeeper

[Method]alloc_and_fill_notify_pkt

Depending on the ethertype, by using rte_pktmbuf_append, the following component will be packed into the packet accordingly.   static inline char *rte_pktmbuf_append(struct rte_mbuf *m, uint16_t len) It takes the memory buffer and the its length. It returns the pointer to tail after the insertion of data.   notify_pkt is composed by: link layer header ipv4/ipv6 header udp header ggu_common header

C, Gatekeeper, Linux

Gatekeeper [Network setup]

DPDK(network setup) Add two virtual network interfaces in settings in Virtual Box

Check if the network interfaces have been successfully mapped into lua/if_map.lua

  Check the network devices status using dpdk-devbind.py under gatekeeper/dependencies/dpdk/tools

Load the module vfio-pci /  uio_pci_generic

 

C

Gatekeeper setup (DPDK)

Background   The system has been built using these four Linux distributions.

Thank to the suggestions, I have finally decided to use Kubuntu as the major compilation issues are directly related to the latest version of gcc compiler, i.e. gcc >7, together with latest Linux kernel. The platform that I have chosen:

  Setup   Dependency (gatekeeper) To…

Continue Reading

Fix, Windows

Recover corrupted USB from format of other OS to windows

Call diskpart utility In Windows cmd.exe

  To see the list of disk attached

  Select the disk as target and rebuild the partition

  Select the partition 1 built and format the disk, for example, FAT32