smuellerDD / libkcapi

Linux Kernel Crypto API User Space Interface Library
http://www.chronox.de/libkcapi
Other
173 stars 72 forks source link

Append newline to stdout #159

Closed yixiangzhike closed 1 year ago

yixiangzhike commented 1 year ago

Append newline to stdout for printing hash may be a good experience. [root@USER libkcapi]# sha256hmac -L e652726ddb463ac08554ef8c8e0c1c17e62e637b70b2b01545db7cfcb154c869[root@USER libkcapi]#

smuellerDD commented 1 year ago

Am Montag, 26. Juni 2023, 16:38:40 CEST schrieb yixiangzhike:

Hi yixiangzhike,

Thanks for the patch, but can you please help me when you see the issue that -

newline is zero? Even if it can get zero, shouldn't that location where it can become zero be fixed?

Ciao Stephan

yixiangzhike commented 1 year ago

Am Montag, 26. Juni 2023, 16:38:40 CEST schrieb yixiangzhike: Hi yixiangzhike, Thanks for the patch, but can you please help me when you see the issue that - newline is zero? Even if it can get zero, shouldn't that location where it can become zero be fixed? Ciao Stephan

Thank you for your reminder. The newline in the structure PARAMS_SELF_FIPSCHECK and PARAMS_SELF_HMACCALC can't be changed after they are defined. In fact, zero is the default initialization value at definition time. Perhaps, we can initialize it to 1.I have changed this.

PARAMS_SELF_FIPSCHECK https://github.com/smuellerDD/libkcapi/blob/9471ca227de720a4fe84db20966af162ef15760f/apps/kcapi-hasher.c#L903

PARAMS_SELF_HMACCALC https://github.com/smuellerDD/libkcapi/blob/9471ca227de720a4fe84db20966af162ef15760f/apps/kcapi-hasher.c#L909

smuellerDD commented 1 year ago

Applied, thanks.