Changeset 13224 in project


Ignore:
Timestamp:
02/09/09 13:42:10 (11 years ago)
Author:
Alaric Snell-Pym
Message:

V0.4

Location:
release/3/ugarit/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • release/3/ugarit/trunk/ugarit-core.scm

    r13116 r13224  
    55(use posix)
    66(use tiger-hash)
     7(use aes)
     8(use crypto-tools)
    79(use z3)
    810(use lzma)
     
    117119     
    118120(define (choose-crypto-functions config)
    119    (case config
    120       ((#f) (values
     121   (match config
     122      (#f (values
    121123         (lambda (block) block)
    122124         (lambda (block) block))) ; No encryption
     125      (('aes keyhex)
     126         (let ((key (hexstring->blob keyhex))
     127               (iv (make-blob 16)) ; IV is pseudo-randomly generated based on the blocks we are fed as an entropy source
     128               (stir-iv! (lambda (iv block)
     129                  (move-memory! (string->blob
     130                     (tiger192:binary-digest (string-append (tiger192:binary-digest block) (blob->string iv))))
     131                     iv 16))))
     132               
     133               ; Generate initial IV from the key and current time
     134               (move-memory! (string->blob (tiger192:binary-digest
     135                  (string-append (blob->string key) (number->string (time->seconds (current-time)))))) iv 16)
     136
     137               (let-values (((encryptor decryptor)
     138                  (case (blob-size key)
     139                     ((16) (values
     140                        (make-aes128-encryptor key)
     141                        (make-aes128-decryptor key)))
     142                     ((24) (values
     143                        (make-aes192-encryptor key)
     144                        (make-aes192-decryptor key)))
     145                     ((32) (values
     146                        (make-aes256-encryptor key)
     147                        (make-aes256-decryptor key)))
     148                     (else
     149                        (signal (make-property-condition 'exn 'message "AES keys must be 16, 24, or 32 bytes long" 'arguments keyhex))))))
     150                  (let ((cbc-encryptor (make-cbc*-encryptor encryptor 16))
     151                        (cbc-decryptor (make-cbc*-decryptor decryptor 16)))
     152                     (values
     153                        (lambda (block)
     154                           (stir-iv! iv block)
     155                           (blob->u8vector/shared (cbc-encryptor (u8vector->blob/shared block) iv)))
     156                        (lambda (block) (blob->u8vector/shared (cbc-decryptor (u8vector->blob/shared block)))))))))
    123157      (else (signal (make-property-condition 'exn 'message "Unknown encryption type" 'arguments config)))))
    124158
     
    140174         (match confentry
    141175            ('double-check (set! *double-check?* #t))
    142             (('storage 'fs path) (set! *storage*
     176            (('storage 'fs path) (set! *storage* ; FIXME: Split this into a plugin registry thingy
    143177               (backend-fs path)))
    144178            (('storage 'log logpath indexpath tagspath) (set! *storage*
     
    149183               (backend-debug (backend-fs path) "DEBUG")))
    150184            (('compression . conf) (set! *compression* conf))
    151             (('encryption . conf) (set! *compression* conf))
     185            (('encryption . conf) (set! *crypto* conf))
    152186            (_ (signal (make-property-condition 'exn 'message "Unknown configuration entry" 'arguments confentry)))))
    153187         config)
     
    166200            store-ctime?
    167201            ; FIXME: Don't just use hash+type as the key, hash the type in so keys are all the same length
     202            ; Also, incorporate some key data into the hash somehow, so that attackers can't just look in the
     203            ; archive for known block hashes
    168204            (lambda (block type) (string-append (tiger192:digest block) (symbol->string type)))
    169205            compress
  • release/3/ugarit/trunk/ugarit.scm

    r13103 r13224  
    146146            (("cd" "..")
    147147               (void)) ; Go up one level
    148             ((or ("bye") ("quit"))
     148            ((or ("bye") ("quit") ("exit"))
    149149               (quit-continuation (void)))
    150150            (("ls" "-l" . globparts)
  • release/3/ugarit/trunk/ugarit.setup

    r13116 r13224  
    88(compile ugarit.scm)
    99(install-program 'ugarit "ugarit"
    10   '((version 0.3)
     10  '((version 0.4)
    1111    (documentation "ugarit.html")))
Note: See TracChangeset for help on using the changeset viewer.