Coherence
Search…
Understanding-the-code

Overview

In this page we are going to explain/describe the coherence's code, this code is built with the help of:

params.h

    It defines (with preprocessor) which algorithms are going to supported
    It defines info_log structure to store the log data
    It defines params structure to help to parse json data and share it with the functions

coherence.c

In this file is main function. We create a tcp server with libuv, validate the input, create the logs output and send the client's input to be parsed.
    main() displays the banner, create the tcp server, starts the event loop and call on_new_connection()
    on_new_connection() accepts the clients, calls alloc_buffer() and on_read()
    alloc_buffer() creates the buffer to store client's input
    on_read() reads data from socket, starts t
      if (nread < 0) an error on reading socket data
      if (nread >= 0) data is read, creates log info, validate the buffer with ok_buff(),if the buffer isn't ok close the connection, if the buffer is ok sends the input to PARSING() , writes the answer, parse_log cleans the log structure and prints the log.

Further reading

parsing.h

    PARSING() parse the json input with Parsingjson() ,and address the algorithm to its functions
    parse_log parse the log, basically delete sensitive information like private keys with Clear2json()

Further reading

parse-func.h

In this file we can find functions to validate inputs from json client input.

crypt-argon2.h

Functions to process argon2 requests

Further reading

crypt-block.h

Functions to process block cipher requests

Further reading

crypt-dh.h

Functions to process Diffie-Hellman requests

Further reading

crypt-dsa.h

Functions to process DSA requests

Further reading

crypt-ecc.h

Functions to process Elliptic Curves requests

Further reading

crypt-hash.h

Functions to process HASh requests

Further reading

crypt-mac.h

Functions to process MAC requests

Further reading

crypt-ntru.h

Functions to process NTRU requests

Further reading

crypt-oqs.h

Functions to process Post Quantum Algorithms requests

Further reading

crypt-rand.h

Functions to process Rand numbers generation requests

Further reading

crypt-rsa.h

Functions to process RSA requests

Further reading

crypt-stream.h

Functions to process Stream Ciphers requests

Further reading