Polarssl libraries

Rip Cord

Administrator
Staff member
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:

Rip Cord

Administrator
Staff member
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
 

Attachments

  • sha1.zip
    117.7 KB · Views: 2
  • file-sha1.zip
    187.2 KB · Views: 3

Rip Cord

Administrator
Staff member
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
 

Attachments

  • sha256.zip
    141.3 KB · Views: 3
  • file-sha256.zip
    302.2 KB · Views: 3

Rip Cord

Administrator
Staff member
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
 

Attachments

  • md5.zip
    116.4 KB · Views: 2
  • file-md5.zip
    196.5 KB · Views: 1

Rip Cord

Administrator
Staff member
Developer
this is the aes library

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

Attachments

  • aes.zip
    167.2 KB · Views: 4
  • aes-test.zip
    235.1 KB · Views: 1

Rip Cord

Administrator
Staff member
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.
 

Rip Cord

Administrator
Staff member
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.
 

Attachments

  • polarssl-libs-readme.txt
    2.7 KB · Views: 1
Last edited:

Rip Cord

Administrator
Staff member
Developer
here is sha1 for linux. much simpler without all those settings.

Code:
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:
./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
 

Attachments

  • sha1-linux.zip
    24 KB · Views: 0

Rip Cord

Administrator
Staff member
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:
  int sha1_file( const char *path, unsigned char output[20] );
becomes this:
Code:
 _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)
 

Attachments

  • sha1dll-vs2005.zip
    1.4 MB · Views: 1
  • sha1dll-vs2008.zip
    1.3 MB · Views: 1
Top