Coherence
  • Home
  • Rand
  • Hash
  • Argon2
  • Poly1305
  • Stream-ciphers
  • Block-ciphers
  • HMAC
  • CMAC
  • VMAC
  • DSA
  • RSA
  • DH
  • ECC
  • ECDH
  • Curve-25519
  • NTRU
  • Security
  • Openssl
  • Json-reference
  • Links
  • Understanding-the-code
Powered by GitBook
On this page
  • Overview
  • params.h
  • coherence.c
  • Further reading
  • parsing.h
  • Further reading
  • parse-func.h
  • crypt-argon2.h
  • Further reading
  • crypt-block.h
  • Further reading
  • crypt-dh.h
  • Further reading
  • crypt-dsa.h
  • Further reading
  • crypt-ecc.h
  • Further reading
  • crypt-hash.h
  • Further reading
  • crypt-mac.h
  • Further reading
  • crypt-ntru.h
  • Further reading
  • crypt-oqs.h
  • Further reading
  • crypt-rand.h
  • Further reading
  • crypt-rsa.h
  • Further reading
  • crypt-stream.h
  • Further reading

Was this helpful?

Understanding-the-code

PreviousLinks

Last updated 4 years ago

Was this helpful?

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

[cmac example] ()

argon2
cryptopp
libntru
liboqs
libuv
rapidjson
libuv - uv_stream
libuv sample
libuv-dox-examples
rapidjson intro
example
example
aes example
example
example
example
example
hmac example
https://www.cryptopp.com/wiki/CMAC
example
example
example
example
example