mimoo / disco-c

A tiny C cryptographic library to encrypt sessions, authenticate messages, sign, hash, etc. based only on SHA-3 and Curve25519
https://embeddeddisco.com/
Apache License 2.0
65 stars 3 forks source link

size #14

Open mimoo opened 5 years ago

mimoo commented 5 years ago

After compiling with -Os -DNDEBUG (-Os optimizes for size, -DNDEBUG removes asserts):

$ cloc lib
      10 text files.
      10 unique files.                              
       1 file ignored.

github.com/AlDanial/cloc v 1.80  T=0.01 s (613.7 files/s, 99896.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                                5            117            259            766
C/C++ Header                     4             57            101            165
-------------------------------------------------------------------------------
SUM:                             9            174            360            931
-------------------------------------------------------------------------------

So under 1000 LOC. That's pretty good :)

$ size *.o *.so
   text    data     bss     dec     hex filename
   2850       0       0    2850     b22 disco_asymmetric.o
   1556       0       0    1556     614 disco_symmetric.o
    217       4       0     221      dd randombytes.o
   1899       0       0    1899     76b tweetstrobe.o
   1976       0       0    1976     7b8 tweetX25519.o
  12068     676       4   12748    31cc disco.so

I think this all look pretty good. Although I'm not sure yet what is considered "good".

$ ls -l | grep "[\.o]$"
-rw-r--r-- 1 vagrant vagrant  5816 Dec  2 20:41 disco_asymmetric.o
-rwxr-xr-x 1 vagrant vagrant 22088 Dec  2 20:41 disco.so
-rw-r--r-- 1 vagrant vagrant  4768 Dec  2 20:41 disco_symmetric.o
-rw-r--r-- 1 vagrant vagrant  1920 Dec  2 20:41 randombytes.o
-rw-r--r-- 1 vagrant vagrant  4048 Dec  2 20:41 tweetstrobe.o
-rw-r--r-- 1 vagrant vagrant  4016 Dec  2 20:41 tweetX25519.o

The size of disco.so is weirdly big compared to what I got with the size tool.