Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023-11-20 08:14 UTC-0800 Eric Lendvai (eric/at/lendvai.us) #318

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EricLendvai
Copy link

No description provided.

@alcz
Copy link
Contributor

alcz commented Nov 15, 2023

Looked at this today, feels like a good job by Eric merging neccesary changes to incorporate hbcrypto from 3.4 to 3.2. There are some adaptation in core/rtl HB_SHA2* functionality and minor hbdefs.h addition. I'd say this could go in. If nobody else has objections, please commit as squashed. Plus typical doubts, i think some additional ChangeLog.txt entries from 3.4 should be taken.

@tuffnatty
Copy link
Member

tuffnatty commented Nov 15, 2023

Hmm, looks like now RTL depends on contrib?

EDIT: Oh sorry, I've misread the patch.

@alcz
Copy link
Contributor

alcz commented Nov 15, 2023

AFAICS, core [rtl/sha1.c sha2.c hbsha1.c hbsha2.c] would depend on hbcrypto.h but not on the contrib

@@ -0,0 +1,46 @@
/* --------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not this file a copy of hbcrypto.hbx? Is it needed here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly not. Thanks for spotting. Probably was created by wrong .hbx specifier in .hbp file - a difference between Harbour 3.2 and 3.4 hbmk2.

@alcz alcz force-pushed the hbcrypto_from_viktor_szakats branch 2 times, most recently from 3296cb7 to 343b416 Compare November 20, 2023 17:42
@alcz
Copy link
Contributor

alcz commented Nov 20, 2023

force pushed as single commit with @vszakats as author, @EricLendvai as commiter. This is a bit of a merge, so i've imported many past ChangeLog entries from Viktor too. Plus updated core SHA1 routines from Harbour 3.4 too. Please recheck and ack if we want this in.

Will force-push again in a minute. Should have been commit -a

@alcz alcz force-pushed the hbcrypto_from_viktor_szakats branch from 343b416 to ed841ee Compare November 20, 2023 17:56
@alcz
Copy link
Contributor

alcz commented Nov 20, 2023

Here we go again with a force-push...

@alcz alcz changed the title 2023-09-27T08:48:29Z Eric Lendvai (eric/at/lendvai.us) 2023-11-20 08:14 UTC-0800 Eric Lendvai (eric/at/lendvai.us) Nov 20, 2023
@alcz alcz force-pushed the hbcrypto_from_viktor_szakats branch from ed841ee to dde43d3 Compare November 20, 2023 18:12
  * contrib/hbcrypto/hbcrypto.hbp
    * fix hbmk2's .hbx specifier after merge by Eric Lendvai
  * ChangeLog.txt
    * merged in hbcrypto related log entries from Harbour 3.4
  * src/rtl/sha1.c
  * src/rtl/sha1.h
  * src/rtl/sha1hmac.c
  * src/rtl/sha1hmac.h
  * src/rtl/hbsha1.c
  * src/rtl/hbsha1hm.c
    * merged SHA1 cleanups from Harbour 3.4, many thanks Viktor

2023-11-20 08:14 UTC-0800 Eric Lendvai (eric/at/lendvai.us)
  + contrib/hbcrypto/*
  * contrib/hbplist.txt
  * contrib/hbrun/hbrun.hbp
  * include/Makefile
  * include/hbcrypto.h
  * include/hbdefs.h
  * package/harbour.spec
  * src/rtl/sha2.c
  * src/rtl/sha2hmac.c
  * src/rtl/hbsha2hm.c
  * src/rtl/hbsha2.c
    + incorporated contrib/hbcrypto from Viktor Szakats repo

2017-10-06 16:11 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.hbp
  + contrib/hbcrypto/3rd/ed25519/add_scalar.c
    + sync public API with upstream

2017-05-15 15:28 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/_compat.h
    ! fix to define `SIZE_MAX`. Required in certain Linux environments
      Thanks to Aleksander Czajczynski for the patch.

  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/rddads/rddads.hbp
    ! respect `HB_BUILD_3RDEXT=no`

2017-04-08 00:01 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/sha3.c
    * silence 64-bit msvc warnings
    ! fix parameter size for 64-bit Windows

  * src/rtl/sha1.c
    ! fix 64-bit msvc warning

2017-02-19 21:20 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/crypto_scrypt.h
  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
    ! fix another C99 issue. Thanks to Alex Strickland.
      Ref:
https://github.com/vszakats/hb/issues/270#issuecomment-280947348

2017-03-21 18:25 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.diff
  * contrib/hbcrypto/3rd/ed25519/ed25519.hbp
  * contrib/hbcrypto/3rd/ed25519/ge.c
  * contrib/hbcrypto/3rd/ed25519/key_exch.c ->
contrib/hbcrypto/3rd/ed25519/key_exchange.c
  * contrib/hbcrypto/3rd/ed25519/LICENSE.txt ->
contrib/hbcrypto/3rd/ed25519/license.txt
  * contrib/hbcrypto/3rd/ed25519/precompd.h ->
contrib/hbcrypto/3rd/ed25519/precomp_data.h
    * use original (non-short) filenames
      to reduce local differences of vendored code

2017-02-19 17:38 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/insecure_memzero.c
  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  * contrib/hbcrypto/3rd/scrypt/sha256.h
  + contrib/hbcrypto/3rd/scrypt/_compat.h
    ! rework patch to make old MSVC versions (MSVC 2008) happy,
      fixing another instance of C99-ism.
      My last effort into this, from this point I'd like to kindly
      ask for patches to support this compiler.

2017-02-19 14:18 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/insecure_memzero.c
  * contrib/hbcrypto/3rd/scrypt/insecure_memzero.h
  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
  * contrib/hbcrypto/3rd/scrypt/sha256.c
    ! avoid another C99 #include <stdint.h>
    ! replace 'inline' with _HB_INLINE_ and
      make sure to #include "hbdef.h" before it.
      Ref:
https://github.com/vszakats/hb/issues/270#issuecomment-280918348

2017-02-17 12:52 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * include/hbdefs.h
    + add HB_C99_STATIC and HB_C99_RESTRICT type qualifiers
      currently enabled for gcc/clang family

  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
  * contrib/hbcrypto/3rd/scrypt/sha256.c
    % restore C99 static/restrict qualifiers on compilers that support
it

2017-02-17 12:24 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/crypto_scrypt.h
    * cleanup

  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  * contrib/hbcrypto/3rd/scrypt/sha256.h
  * contrib/hbcrypto/hbcrypto.hbp
    + make sha256.{c,h} compatible with C compilers not supporting C99
      (untested though)
      Ref:
https://github.com/vszakats/hb/issues/270#issuecomment-280623411

2017-02-13 12:34 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/scrypt.diff
  * contrib/hbcrypto/3rd/scrypt/scrypt.hbp
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  + contrib/hbcrypto/3rd/scrypt/config.h
  + contrib/hbcrypto/3rd/scrypt/insecure_memzero.c
  + contrib/hbcrypto/3rd/scrypt/insecure_memzero.h
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.h ->
contrib/hbcrypto/3rd/scrypt/crypto_scrypt.h
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.c ->
contrib/hbcrypto/3rd/scrypt/crypto_scrypt-ref.c
    * update to scrypt 1.2.1 (from 1.1.6)
    * restore to use its own implementation of SHA256 and HMAC-SHA256
      This makes patch smaller, final binaries somewhat smaller, but
      this appears to be a more polished SHA256 implementation than
      core one. WARNING: C build fallouts possible.
    * use original filenames

  * contrib/hbcrypto/hbcrypto.hbp
    * use original scrypt public header filename in dependency
detection.
      This makes envvar HB_WITH_SCRYPT actually useful to point to
      non-vendored scrypt package.

2017-01-31 15:07 UTC Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbrun/hbrun.hbp
    + link hbcrypto lib by default

2016-08-19 13:17 UTC+0200 Viktor Szakats (vszakats
users.noreply.github.com)
  * contrib/hbcrypto/tests/pbkdf2.prg
  * contrib/hbcrypto/tests/scrypt.prg
    * update/add finalized RFC for test vectors

2016-01-20 12:20 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.dif
  * contrib/hbcrypto/3rd/ed25519/fixedint.h
    ! fix (hopefully) for msvc 2010 and above builds
      Closes https://github.com/vszakats/hb/issues/170
      Tests:
         MSVC 2015:
https://ci.appveyor.com/project/vszakats/hb/build/3.4.1004
         MSVC 2013:
https://ci.appveyor.com/project/vszakats/hb/build/3.4.1005
    * remove old fix attempt

  * contrib/hbcrypto/hbcrypto.hbp
    + reenable for msvc

2015-08-27 22:05 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.dif
  * contrib/hbcrypto/3rd/ed25519/fixedint.h
    ! fix build error with MSVC 2010. This compiler offers <stdint.h>
      but it seems to miss type 'int32_t' anyway. This is a hack to
      address this specific problem, it may need further updates
      to form a general solution.
      Fixes https://github.com/vszakats/hb/issues/158

2015-08-24 19:05 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.c
  * contrib/hbcrypto/3rd/scrypt/scrypt.dif
    * eliminate reliance on 'errno' making this code
      more portable (to wce e.g.)
      Fixes https://github.com/vszakats/hb/issues/156

2015-08-20 03:07 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  + contrib/hbcrypto/sha3.c
  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/hbcrypto/hbcrypto.hbx
  + contrib/hbcrypto/tests/sha3.prg
    + add SHA3 functions:
      hb_SHA3224( <cData>, [<lBinary=.F.>] ) -> <cHash>
      hb_SHA3256( <cData>, [<lBinary=.F.>] ) -> <cHash>
      hb_SHA3384( <cData>, [<lBinary=.F.>] ) -> <cHash>
      hb_SHA3512( <cData>, [<lBinary=.F.>] ) -> <cHash>
      hb_SHAKE128( <cData>, [<nHashBytes=32>], [<lBinary=.F.> ] ) ->
<cHash>
      hb_SHAKE256( <cData>, [<nHashBytes=64>], [<lBinary=.F.> ] ) ->
<cHash>

2015-08-08 14:50 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.dif
  * contrib/hbcrypto/3rd/ed25519/fixedint.h
    ! silence msvc64 (msvs 2015) redefinition warnings

  * contrib/hbcrypto/blake2s.c
    ! silence msvc64 warnings:
      warning C4244: '+=': conversion from 'HB_SIZE' to 'HB_U32',
possible loss of data

2015-08-08 13:48 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/scrypt.c
    ! fix extern declarations when built in C++ mode

  * contrib/hbcrypto/3rd/ed25519/ed25519.dif
  * contrib/hbcrypto/3rd/ed25519/fe.c
    ! fix msvc64 warning:
      warning C4146: unary minus operator applied to unsigned type,
result still unsigned

  * contrib/hbcrypto/bcrypt.c
    ! fix msvc64 warnings:
      warning C4267: 'argument': conversion from 'size_t' to 'HB_U16',
possible loss of data

  * src/rtl/sha1.c
    * silence msvc warning:
      conversion from 'HB_SIZE' to 'sha1_quadbyte', possible loss of
data

2015-07-23 11:32 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/bcrypt.c
    * silence msvc warning
      Closes https://github.com/vszakats/hb/issues/145

2015-07-19 15:15 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  - contrib/hbcrypto/3rd/scrypt/sha256.h
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.c
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.h
  * contrib/hbcrypto/3rd/scrypt/scrypt.dif
  * contrib/hbcrypto/3rd/scrypt/scrypt.hbp
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/hbcrypto/pbkdf2.c
    * use more Harbour types for better portability
    * enable the contrib for all platforms

  * contrib/hbcrypto/3rd/ed25519/ed25519.dif
  * contrib/hbcrypto/3rd/ed25519/precompd.h
  * contrib/hbcrypto/3rd/ed25519/sc.h
    * add ending newlines to silence watcom warning

2015-07-17 21:31 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/hbcrypto/hbcrypto.hbx
  + contrib/hbcrypto/scryptcf.prg
    + add helper function:
        hb_scrypt_setup( <nOpsLimit>, <nMemLimit>, @<N>, @<r>, @<p> ) ->
NIL

2015-07-17 01:22 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/ed25519/ed25519.h
  * contrib/hbcrypto/3rd/ed25519/sign.c
    + add function ed25519_get_pubkey()
      Related Issue: orlp/ed25519#1
      Related PR: orlp/ed25519#5

  * contrib/hbcrypto/ed25519.c
  * contrib/hbcrypto/hbcrypto.hbx
  * contrib/hbcrypto/tests/ed25519.prg
    + add wrapper HB_ED25519_GET_PUBKEY() to derive
      public key from secret key
    * modify HB_ED25519_SIGN() and HB_ED25519_KEY_EXCHANGE()
      to return value directly (was: by reference)

  * contrib/hbcrypto/bcrypt.c
    * cleanups

2015-07-16 20:12 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  + contrib/hbcrypto/bcrypt.c
  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/hbcrypto/hbcrypto.hbx
  + contrib/hbcrypto/tests/bcrypt.prg
    + add new secure hash function:
         hb_bcrypt( <cPassword>, <cSalt>, <nRounds>, <nKeyLen> ) ->
<cKey>
      Useful for interoparibility, other than that hb_scrypt()
      is superior. See inside for code authors and licenses.
      TODO: deduplicate Blowfish code against core

  * contrib/hbcrypto/scrypt.c
    * minor

2015-07-16 02:06 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/blake2b.c
  * contrib/hbcrypto/blake2s.c
    ! fix HB_BLAKE2*() to return correct length when
      passing a 3rd length parameter and passing .T. as 4th

2015-07-15 13:12 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  - contrib/hbcrypto/3rd/scrypt/config.h
  - contrib/hbcrypto/3rd/scrypt/scrypt_p.h
  - contrib/hbcrypto/3rd/scrypt/u_sysend.h
  * contrib/hbcrypto/3rd/scrypt/c_scrypt.c
  * contrib/hbcrypto/3rd/scrypt/scrypt.dif
  * contrib/hbcrypto/3rd/scrypt/scrypt.hbp
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  * contrib/hbcrypto/hbcrypto.hbp
    * rely more on Harbour macros and drop
      redundant code

  * contrib/hbcrypto/pbkdf2.c
    ! do not strip 'const'

  + contrib/hbcrypto/tests/pbkdf2.prg
  * contrib/hbcrypto/tests/scrypt.prg
    * split into two

2015-07-14 00:23 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/3rd/scrypt/scrypt.dif
  * contrib/hbcrypto/3rd/scrypt/sha256.c
  * contrib/hbcrypto/3rd/scrypt/sha256.h
    % use core SHA256/HMAC implementations instead
      of local duplicates

  * src/rtl/hbsha2.c
  * src/rtl/hbsha2hm.c
    * minor cleanups

2015-07-13 23:54 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * contrib/hbcrypto/ed25519.c
  * contrib/hbcrypto/hbcrypto.hbp
  * contrib/hbcrypto/hbcrypto.hbx
  * contrib/hbcrypto/tests/ed25519.prg
    * finalizing ed25519 functions

2015-07-13 23:47 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  + contrib/hbcrypto/3rd/ed25519
  + contrib/hbcrypto/ed25519.c
  + contrib/hbcrypto/tests/ed25519.prg
    + add ed25519 public-key signature functionality
         https://ed25519.cr.yp.to
      uses low-level code from:
         https://github.com/orlp/ed25519

  * contrib/hbcrypto
    * merge hbblake2 into hbcrypto

2015-07-13 23:12 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  * include/hbcrypto.h
  * src/rtl/hbsha1.c
  * src/rtl/hbsha1hm.c
  * src/rtl/hbsha2.c
  * src/rtl/hbsha2hm.c
  * src/rtl/sha1.c
  * src/rtl/sha1.h
  * src/rtl/sha1hmac.c
  * src/rtl/sha1hmac.h
  * src/rtl/sha2.c
  * src/rtl/sha2hmac.c
    + use Harbour index type in low-level SHA code
    % drop high-level hack compensating for fixed sized
      low-level indexes in 64-bit builds
    ! fix an unused variable in conditional code
    ! fix a wrong header reference after prev updates

2015-07-13 19:39 UTC+0200 Viktor Szakats (vszakats users.noreply.github.com)
  + include/hbcrypto.h
  * include/Makefile
  * src/rtl/sha2.c
  * src/rtl/sha2hmac.c
    + move sha2 and hmac/sha2 related headers to Harbour
      header directory so they can be used by other components.
    + export sha2 and hmac/sha2 low-level functions from Harbour dynlib
    % use HB_ULL() macro instead of local replica in sha2.c
    % drop unused #include <strings.h> from sha2.c and sha2hmac.c

2013-11-26 00:51 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
  + contrib/hbcrypto/3rd/scrypt/*
  + contrib/hbcrypto/3rd/scrypt/scrypt.dif
  + contrib/hbcrypto/3rd/scrypt/scrypt.hbc
  + contrib/hbcrypto/3rd/scrypt/scrypt.hbp
    + added 3rd party code from:
         https://www.tarsnap.com/scrypt/
      The work of Colin Percival, implementing safe password
      hashing function scrypt and PBKDF2 which it depends on.
      Plus Harbour build glue and patches to work with some
      other compilers than gcc and better work with Harbour.

  * contrib/hbplist.txt
  + contrib/hbcrypto/pbkdf2.c
  + contrib/hbcrypto/scrypt.c
  + contrib/hbcrypto/strcmpc.c
  + contrib/hbcrypto/tests/hbmk.hbm
  + contrib/hbcrypto/tests/test.prg
    + added hbcrypto package implementing following password
      hashing wrapper functions:
         hb_scrypt( <cPassword>, <cSalt>, <nCPU>, <nMem>, <nParallel>,
<nKeyLen> ) -> <cKey>
         hb_pbkdf2_sha256( <cPassword>, <cSalt>, <nCount>, <nKeyLen> )
-> <cKey>
    + added function for length-constant time string comparison:
         hb_strcmpc( <cString1>, <cString2> ) -> <lEqual>
@alcz alcz force-pushed the hbcrypto_from_viktor_szakats branch from dde43d3 to 37b742a Compare November 20, 2023 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants