2010-06-22 17:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/hbsha2hm.c
  * src/rtl/hbsha2.c
    * Switched to use triplet API instead of the all-in-one calls,
      in preparation for Win64 support.
This commit is contained in:
Viktor Szakats
2010-06-22 15:38:52 +00:00
parent 91a0e2a77e
commit 80e33f6c7f
3 changed files with 38 additions and 8 deletions

View File

@@ -16,6 +16,12 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-06-22 17:37 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbsha2hm.c
* src/rtl/hbsha2.c
* Switched to use triplet API instead of the all-in-one calls,
in preparation for Win64 support.
2010-06-22 17:28 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbsha1.c
* src/rtl/hbsha1hm.c

View File

@@ -57,8 +57,11 @@
HB_FUNC( HB_SHA224 )
{
unsigned char digest[ SHA224_DIGEST_SIZE ];
sha224_ctx ctx;
sha224( hb_parcx( 1 ), hb_parclen( 1 ), digest );
sha224_init( &ctx );
sha224_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
sha224_final( &ctx, digest );
if( ! hb_parl( 2 ) )
{
@@ -73,8 +76,11 @@ HB_FUNC( HB_SHA224 )
HB_FUNC( HB_SHA256 )
{
unsigned char digest[ SHA256_DIGEST_SIZE ];
sha256_ctx ctx;
sha256( hb_parcx( 1 ), hb_parclen( 1 ), digest );
sha256_init( &ctx );
sha256_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
sha256_final( &ctx, digest );
if( ! hb_parl( 2 ) )
{
@@ -89,8 +95,11 @@ HB_FUNC( HB_SHA256 )
HB_FUNC( HB_SHA384 )
{
unsigned char digest[ SHA384_DIGEST_SIZE ];
sha384_ctx ctx;
sha384( hb_parcx( 1 ), hb_parclen( 1 ), digest );
sha384_init( &ctx );
sha384_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
sha384_final( &ctx, digest );
if( ! hb_parl( 2 ) )
{
@@ -105,8 +114,11 @@ HB_FUNC( HB_SHA384 )
HB_FUNC( HB_SHA512 )
{
unsigned char digest[ SHA512_DIGEST_SIZE ];
sha512_ctx ctx;
sha512( hb_parcx( 1 ), hb_parclen( 1 ), digest );
sha512_init( &ctx );
sha512_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
sha512_final( &ctx, digest );
if( ! hb_parl( 2 ) )
{

View File

@@ -57,8 +57,11 @@
HB_FUNC( HB_HMAC_SHA224 )
{
unsigned char mac[ SHA224_DIGEST_SIZE ];
hmac_sha224_ctx ctx;
hmac_sha224( hb_parcx( 2 ), hb_parclen( 2 ), hb_parcx( 1 ), hb_parclen( 1 ), mac, HB_SIZEOFARRAY( mac ) );
hmac_sha224_init( &ctx, hb_parcx( 2 ), hb_parclen( 2 ) );
hmac_sha224_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
hmac_sha224_final( &ctx, mac, HB_SIZEOFARRAY( mac ) );
if( ! hb_parl( 3 ) )
{
@@ -73,8 +76,11 @@ HB_FUNC( HB_HMAC_SHA224 )
HB_FUNC( HB_HMAC_SHA256 )
{
unsigned char mac[ SHA256_DIGEST_SIZE ];
hmac_sha256_ctx ctx;
hmac_sha256( hb_parcx( 2 ), hb_parclen( 2 ), hb_parcx( 1 ), hb_parclen( 1 ), mac, HB_SIZEOFARRAY( mac ) );
hmac_sha256_init( &ctx, hb_parcx( 2 ), hb_parclen( 2 ) );
hmac_sha256_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
hmac_sha256_final( &ctx, mac, HB_SIZEOFARRAY( mac ) );
if( ! hb_parl( 3 ) )
{
@@ -89,8 +95,11 @@ HB_FUNC( HB_HMAC_SHA256 )
HB_FUNC( HB_HMAC_SHA384 )
{
unsigned char mac[ SHA384_DIGEST_SIZE ];
hmac_sha384_ctx ctx;
hmac_sha384( hb_parcx( 2 ), hb_parclen( 2 ), hb_parcx( 1 ), hb_parclen( 1 ), mac, HB_SIZEOFARRAY( mac ) );
hmac_sha384_init( &ctx, hb_parcx( 2 ), hb_parclen( 2 ) );
hmac_sha384_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
hmac_sha384_final( &ctx, mac, HB_SIZEOFARRAY( mac ) );
if( ! hb_parl( 3 ) )
{
@@ -105,8 +114,11 @@ HB_FUNC( HB_HMAC_SHA384 )
HB_FUNC( HB_HMAC_SHA512 )
{
unsigned char mac[ SHA512_DIGEST_SIZE ];
hmac_sha512_ctx ctx;
hmac_sha512( hb_parcx( 2 ), hb_parclen( 2 ), hb_parcx( 1 ), hb_parclen( 1 ), mac, HB_SIZEOFARRAY( mac ) );
hmac_sha512_init( &ctx, hb_parcx( 2 ), hb_parclen( 2 ) );
hmac_sha512_update( &ctx, hb_parcx( 1 ), hb_parclen( 1 ) );
hmac_sha512_final( &ctx, mac, HB_SIZEOFARRAY( mac ) );
if( ! hb_parl( 3 ) )
{