Ticket #1580: 0001-Port-to-CHICKEN-5.patch

File 0001-Port-to-CHICKEN-5.patch, 3.0 KB (added by andyjpb, 5 years ago)

Port hmac to CHICKEN-5

  • hmac.release-info

    From b08ad4699a023ab0f736e073170de92219c598e1 Mon Sep 17 00:00:00 2001
    From: Andy Bennett <andyjpb@ashurst.eu.org>
    Date: Sun, 20 Jan 2019 22:19:22 +0000
    Subject: [PATCH] Port to CHICKEN 5
    
     * New .release-info for releases compatible with CHICKEN 5.
    
     * Provisional 7.2.0 release for CHICKEN 4 and CHICKEN 5.
    
     * Remove the version number from the .setup file. Henrietta will fill it
       in automatically and locally (possibly modified) `chicken-install`s will
       get "unknown" in `chicken-status`.
    
    Signed-off-by: Andy Bennett <andyjpb@ashurst.eu.org>
    ---
     hmac.release-info           |  3 ++-
     hmac.release-info.chicken-5 |  4 ++++
     hmac.scm                    | 14 ++++++++++++--
     hmac.setup                  |  3 +--
     tests/run.scm               | 12 ++++++++++--
     5 files changed, 29 insertions(+), 7 deletions(-)
     create mode 100644 hmac.release-info.chicken-5
    
    diff --git a/hmac.release-info b/hmac.release-info
    index 50c8853..3573fb9 100644
    a b  
    88(release "6")
    99(release "7")
    1010(release "7.0.1")
    11 (release "7.1.0")
    12  No newline at end of file
     11(release "7.1.0")
     12(release "7.2.0")
  • new file hmac.release-info.chicken-5

    diff --git a/hmac.release-info.chicken-5 b/hmac.release-info.chicken-5
    new file mode 100644
    index 0000000..9070f23
    - +  
     1(repo git "git://github.com/ThomasHintz/chicken-scheme-{egg-name}.git")   ; optional
     2
     3(uri targz "https://github.com/ThomasHintz/chicken-scheme-{egg-name}/tarball/{egg-release}")
     4(release "7.2.0")
  • hmac.scm

    diff --git a/hmac.scm b/hmac.scm
    index e402e2e..b9129dc 100644
    a b  
    55(module hmac
    66  (hmac hmac-primitive)
    77
    8 (import scheme chicken srfi-13)
    9 (use message-digest-basic message-digest-item message-digest-update-item)
     8(import scheme)
     9
     10(cond-expand
     11
     12  (chicken-4
     13    (import chicken srfi-13)
     14    (use message-digest-basic message-digest-item message-digest-update-item))
     15
     16  (chicken-5
     17    (import (chicken base) (chicken bitwise) srfi-13)
     18    (import message-digest-basic message-digest-item message-digest-update-item)))
     19
    1020
    1121(define (hmac-primitive key digest-primitive)
    1222  (let ((block-size (message-digest-primitive-block-length digest-primitive))
  • hmac.setup

    diff --git a/hmac.setup b/hmac.setup
    index 7f7621b..7bc4cfa 100644
    a b  
    1111  ; Files to install for your extension:
    1212  '("hmac.o" "hmac.so" "hmac.import.so")
    1313  ; Assoc list with properties for your extension:
    14   '((version 7.1.0)
    15     (static "hmac.o"))) ;; for static linking
    16  No newline at end of file
     14  '((static "hmac.o"))) ;; for static linking
  • tests/run.scm

    diff --git a/tests/run.scm b/tests/run.scm
    index 9e0dd85..57567e2 100644
    a b  
    22; email: t@thintz.com
    33; license: bsd
    44
    5 (use test)
    6 (use sha1 string-utils hmac)
     5(cond-expand
     6
     7  (chicken-4
     8    (use test)
     9    (use sha1 string-utils hmac))
     10
     11  (chicken-5
     12    (import test)
     13    (import sha1 string-hexadecimal hmac)))
     14
    715
    816(test-group "RFC2202 test vectors"
    917  (define (testv key msg expected)