-
Notifications
You must be signed in to change notification settings - Fork 17
Use Guile-Gcrypt instead of 'openssl' to compute HMACs. #5
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
Open
civodul
wants to merge
1
commit into
jerry40:master
Choose a base branch
from
civodul:use-guile-gcrypt
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,12 @@ | ||
| (use-modules (ice-9 rdelim) | ||
| (ice-9 popen)) | ||
| (define-module (hmac) | ||
| #:use-module (gcrypt hmac) | ||
| #:use-module (gcrypt base16) | ||
| #:use-module (rnrs bytevectors) | ||
| #:export (get-signature)) | ||
|
|
||
| (define (get-signature key str) | ||
| (let* ((p2c (pipe)) | ||
| (read-pipe (car p2c)) | ||
| (write-pipe (cdr p2c)) | ||
| (port (with-input-from-port read-pipe | ||
| (lambda () | ||
| (open-input-pipe (string-append "openssl dgst -sha256 -hmac " key)))))) | ||
| (display str write-pipe) | ||
| (close-port write-pipe) | ||
| (let ((result (read-line port))) | ||
| (close-port read-pipe) | ||
| (close-pipe port) | ||
| (substring result 9)))) | ||
|
|
||
|
|
||
|
|
||
| "Return a hexadecimal string containing the SHA256 HMAC of STR, a string, | ||
| with KEY, another string." | ||
| (bytevector->base16-string | ||
| (sign-data key (string->utf8 str) | ||
| #:algorithm 'sha256))) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get
guile-gcryptfolder after unpackingI installed (Ubuntu 18.04) guile-2.2-dev and texinfo and executed
./configure --prefix=/usr/ --with-libgcrypt-libdir=/usr/lib/x86_64-linux-gnu/and it worked, but make returns an error:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the
guildprogram wasn't found. Didautoreconfemit warnings? What doesgrep GUILD config.logreturn?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autoreconf:
guild:
hm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fishy, indeed! What does
configureshow when looking forguild?I see this:
As a workaround you can always run:
... but that shouldn't be necessary.
HTH!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it is looking for
guld-2.2commandInteresting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand why it searches for
guild-2.2.guile.m4:
So it finds guile-2.2 and therefore thinks that suffix for guild should be the same.
PS It seems that your workaround worked:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I get this message (guile can't find hmac module in the current dir?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggests that
hmac.scmis not in Guile's module search path.To fix that, you need to either set
GUILE_LOAD_PATHto contain the current directory (it's not there by default, for security reasons), or to pass the-Lflag toguile. See the manual for details.HTH!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
Yes I think I can avoid this, but I'd like to provide an installation process to users as easy as it can be. I'm afraid that people can be disappointed if the process is too difficult. Can we do anything in order to make it smoother?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello!
I understand your concern. I feel like
./configure && make && make installis as "simple as it can be" in terms of build systems and "least surprise", but I agree that even that can be daunting to some users.To me, given my own biases ;-), the best answer to such questions is packaging: guile-gcrypt is already in openSuSE, in AUR (unofficial Arch packages), and in Guix. If more distros ship it, then it'll be easier for users building guile-kernel from source.
In the meantime, I don't have a better answer!
Ludo'.