Want to Join Us ?

you'll be able to discuss, share and send private messages.

Polarssl libraries

Discussion in 'C' started by Rip Cord, Nov 6, 2020.

Share This Page

  1. Rip Cord

    Administrator Staff Member Admin Developer

    Polarssl is available in a large visual studio solution containing numerous libraries and an extensive configuration file. Here are a few of the libraries, each separated into its own solution and in the standard configuration.

    edit:
    the first file in each post has the VS solution and compiled lib
    the second file has the sample program VS solution and compiled app
     
    Last edited: Nov 27, 2020
    samoray likes this.
  2. Rip Cord

    Administrator Staff Member Admin Developer

    this one is the sha1 library.
    include sha1.lib and sha1lib.h in projects to use the sha1 functions: sha1 (of buffer), sha1_file, sha1_hmac, and sha1_self_test.


    file-sha1.zip contains a small sample program which computes the sha1 of a file using sha1.lib and sha1lib.h
     

    Attached Files:

  3. Rip Cord

    Administrator Staff Member Admin Developer

    this one is the sha256 library.
    include sha256.lib and sha256lib.h in projects to use the sha56 functions: sha256 (of buffer), sha256_file, sha256_hmac, and sha256_self_test.

    file-sha256.zip contains a small sample program which computes the sha256 of a file using sha256.lib and sha256lib.h
     

    Attached Files:

    storm shadow likes this.
  4. Rip Cord

    Administrator Staff Member Admin Developer

    this one is the md5 library.
    include md5.lib and md5lib.h in projects to use the md5 functions: md5 (of buffer), md5_file, md5_hmac, and md5_self_test.

    file-md5.zip contains a small sample program which computes the md5 of a file using md5.lib and md5lib.h
     

    Attached Files:

  5. Rip Cord

    Administrator Staff Member Admin Developer

    this is the aes library

    aes-test is a small sample program that calls the aes self test
     

    Attached Files:

    storm shadow likes this.
  6. storm shadow

    Techbliss Owner Admin Ida Pro Expert Developer

    Thx
     
    Rip Cord likes this.
  7. samoray

    Active Member

    Rip Cord likes this.
  8. Rip Cord

    Administrator Staff Member Admin Developer

    you're welcome
    as many times as I've used sha1 and aes libraries, I should have pre-compiled them a long time ago.
     
  9. Rip Cord

    Administrator Staff Member Admin Developer

    I forgot to include visual studio readme for anyone who usually uses gcc.

    this has the steps and project settings for the sha1 library and sample app. the other libs are the same.
     

    Attached Files:

    Last edited: Nov 30, 2020
    samoray likes this.
  10. Rip Cord

    Administrator Staff Member Admin Developer

    here is sha1 for linux. much simpler without all those settings.

    Code (Text):

    gcc -c sha1.c
    ar crv libsha1.a sha1.o
    gcc -c file-sha1.c
    gcc -o file-sha1 file-sha1.o libsha1.a
     
    tested and working on ubuntu

    Code (Text):

    ./file-sha1 /t
    SHA-1 test #1: passed
    SHA-1 test #2: passed
    SHA-1 test #3: passed
    HMAC-SHA-1 test #1: passed
    HMAC-SHA-1 test #2: passed
    HMAC-SHA-1 test #3: passed
    HMAC-SHA-1 test #4: passed
    HMAC-SHA-1 test #5: passed
    HMAC-SHA-1 test #6: passed
    HMAC-SHA-1 test #7: passed
     
    ./file-sha1 file-sha1.c
    sha1: FCA0DF81825C699397DF4E07D3D9C2BD44DD7458
     
     

    Attached Files:

  11. Rip Cord

    Administrator Staff Member Admin Developer

    here is dll version of sha1 library. I always use the static version for C projects, but dll form can be used in C# gui projects

    mostly same project settings as with static libs, but exported functions must be explicitly exported in their prototypes.
    so instead of creating a separate header file for the referencing project listing only the exported functions, declare them in the regular header with dllexport keyword.

    this:
    Code (Text):
      int sha1_file( const char *path, unsigned char output[20] );  
    becomes this:
    Code (Text):
     _declspec(dllexport) int sha1_file( const char *path, unsigned char output[20] );  
    sha1dll-vs2005.zip has visual studio project for visual studio 2005
    sha1dll-vs2008.zip has visual studio project for visual studio 2008 and above
    (they changed the file naming convention between version 2005 and 2008)
     

    Attached Files:

    storm shadow likes this.
Top