Skip to content

[Bug]: Use of Sha256 instead of wc_Sha256 in sign/verify #510

Description

@andrade

Contact Details

No response

Version

5.6.6-1.3build1 (it's libwolfssl-dev from Ubuntu 24.04 repositories)

Description

wolfSSL installed from repositories in Ubuntu 24.04.

The issue is when running sign/verify examples at signature/rsa_buffer/. Running make I get an error:

$ make sign
gcc -o sign sign.c -Wall -I/usr/local/include -Os -L/usr/local/lib -lm -lwolfssl
sign.c: In function ‘main’:
sign.c:77:5: error: unknown type name ‘Sha256’; did you mean ‘wc_Sha256’?
   77 |     Sha256         sha256;
      |     ^~~~~~
      |     wc_Sha256
sign.c:78:5: error: unknown type name ‘Sha256’; did you mean ‘wc_Sha256’?
   78 |     Sha256*        pSha256 = NULL;
      |     ^~~~~~
      |     wc_Sha256

I can compile $make sign and $ make verify successfully, and run both examples, by replacing Sha256 by wc_Sha256 in sign.c and verify.c.


Note the same issue may be present in a different file but I didn't try running that one:

$ pwd
/home/daniel/tmp/tmpdir/wolfssl-examples

$ grep -rn " Sha256"
signature/rsa_vfy_only/verify.c:120:    Sha256         sha256;
signature/rsa_vfy_only/verify.c:121:    Sha256*        pSha256 = NULL;
(...)

Reproduction steps

  1. Setup:
$ mkdir tmpdir
$ cd tmpdir/
$ git clone https://github.com/wolfSSL/wolfssl-examples/
$ cd wolfssl-examples/signature/rsa_buffer/
  1. Compilation error:
$ make sign
$ make verify
  1. Fixing, then compile and run:
$ sed -i 's/ Sha256/wc_Sha256/g' sign.c verify.c
$ make sign
$ make verify
$ ./verify
$ ./sign "foo"

Relevant log output

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions