sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

Type error with empty array #5

Closed christophejunke closed 6 years ago

christophejunke commented 6 years ago

Error when recompiling the library:

; Evaluation aborted on #<TYPE-ERROR expected-type: "(SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*))"
             datum: #<(SIMPLE-VECTOR 0) {10039E3F5F}>>.

The source of the error is https://github.com/sharplispers/ironclad/blob/d7cce95f0218c8715d500f1aba015753e35354ab/src/public-key/ed448.lisp#L48

Possible fix

Instead of #(), write:

(make-array 0 :element-type '(unsigned-byte 8))

Environment:

SBCL 1.3.13.7.master.75-b464cda (Linux x86/64)

CL-USER> (sb-ext:describe-compiler-policy)
  Basic qualities:
COMPILATION-SPEED = 1
DEBUG = 3
SAFETY = 3
SPACE = 1
SPEED = 1
INHIBIT-WARNINGS = 1
  Dependent qualities:
SB-C::CHECK-CONSTANT-MODIFICATION = 1 -> 3 (yes)
SB-C::TYPE-CHECK = 1 -> 3 (full)
SB-C::CHECK-TAG-EXISTENCE = 1 -> 3 (yes)
SB-C::LET-CONVERSION = 1 -> 0 (off)
SB-C:ALIEN-FUNCALL-SAVES-FP-AND-PC = 1 -> 3 (yes)
SB-C:VERIFY-ARG-COUNT = 1 -> 3 (yes)
SB-C::INSERT-DEBUG-CATCH = 1 -> 3 (yes)
SB-C::RECOGNIZE-SELF-CALLS = 1 -> 0 (no)
SB-C::FLOAT-ACCURACY = 1 -> 3 (full)
SB-C:INSERT-STEP-CONDITIONS = 1 -> 3 (full)
SB-C::COMPUTE-DEBUG-FUN = 1 -> 3 (yes)
SB-C::PRESERVE-SINGLE-USE-DEBUG-VARIABLES = 1 -> 3 (yes)
SB-C::INSERT-ARRAY-BOUNDS-CHECKS = 1 -> 3 (yes)
SB-C::STORE-XREF-DATA = 1 -> 3 (yes)
SB-C:STORE-COVERAGE-DATA = 1 -> 0 (no)
SB-C::STORE-CLOSURE-DEBUG-POINTER = 1 -> 0 (no)
SB-KERNEL:ALLOW-NON-RETURNING-TAIL-CALL = 1 -> 0 (no)

Quicklisp

CL-USER> ql-info:*version* 
"2017-03-06"
CL-USER> (ql:dist-version "quicklisp")
"2018-01-31"
glv2 commented 6 years ago

Fixed in commit 971d231825c421d7d342054359ccb30612f75e60. Thanks.

christophejunke commented 6 years ago

Thanks.