You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
5.3KB

  1. `(== 64 64)
  2. (seed (in "/dev/urandom" (rd 8)))
  3. (load "blake2s.l")
  4. (load "functions.l")
  5. (test
  6. (141 73 237 128 248 152 146 128 222 214 165 183 91 40 149 197 213 215 13 72 101 235 33 202 170 41 133 242 25 116 229 29)
  7. (dh_pubkey
  8. (203 107 104 95 173 233 228 248 76 191 139 222 244 239 244 200 3 216 199 225 17 253 137 203 28 184 126 90 150 41 226 0) ) )
  9. (test
  10. (3 119 169 7 227 26 48 237 195 166 139 135 91 113 126 80 60 189 180 25 83 6 60 170 144 135 246 18 248 228 92 87)
  11. (dh
  12. (203 107 104 95 173 233 228 248 76 191 139 222 244 239 244 200 3 216 199 225 17 253 137 203 28 184 126 90 150 41 226 0)
  13. (169 16 176 101 34 136 158 179 0 171 155 30 165 240 157 104 43 17 37 170 11 123 152 225 183 55 226 195 176 163 111 3) ) )
  14. (test
  15. (229 240 113 156 118 145 247 86 191 129 201 1 210 198 211 96 126 162 190 165 219 189 123 63 17 26 152 213 173 233 236 77)
  16. (hmac
  17. (96 226 109 174 243 39 239 192 46 195 53 226 160 37 210 208 22 235 66 6 248 114 119 245 45 56 209 152 139 120 205 54)
  18. (72 231 231 229 122 241 215 233 127 29 96 69 242 145 207 219 15 162 137 130 148 142 70 209 234 51 13 164 110 119 129 14) ) )
  19. (test
  20. (170 146 47 242 84 79 142 158 105 69 108 188 12 48 160 7 126 101 29 25 160 95 41 184 115 119 129 165 114 161 123 178)
  21. (hmac
  22. (153 70 196 58 152 133 47 108 184 57 21 207 164 231 210 232 226 22 87 214 186 3 62 51 138 112 182 89 180 193 224 184)
  23. (83 103 202 233 31 99 239 200 53 226 11 231 219 118 70 228 100 48 224 188 69 208 26 120 154 254 41 35 192 10 204 36) ) )
  24. (let (M (need 255 255) K (need 5 255))
  25. (hmac K M)
  26. (test M (need 255 255))
  27. (test K (need 5 255)) )
  28. (let (M (need 255 255) K (need 255 255))
  29. (hmac K M)
  30. (test M (need 255 255))
  31. (test K (need 255 255)) )
  32. (test
  33. (25 186 65 75 100 131 175 85 176 41 82 25 79 229 251 40 137 69 104)
  34. (lock_aead
  35. (range 0 31)
  36. (need 12 0)
  37. (list 1 2 3)
  38. (list 1 2 3) ) )
  39. (test
  40. (list 1 2 3)
  41. (unlock_aead
  42. (range 0 31)
  43. (need 12 0)
  44. (25 186 65 75 100 131 175 85 176 41 82 25 79 229 251 40 137 69 104)
  45. (list 1 2 3) ) )
  46. # test empty AD for *Enc-*Dec
  47. (test
  48. (111 11 1)
  49. (unlock_aead
  50. (need 32 255)
  51. (need 12 77)
  52. (lock_aead
  53. (need 32 255)
  54. (need 12 77)
  55. (list 111 11 1)
  56. NIL )
  57. NIL ) )
  58. # test empty AD and Plain for *Enc-*Dec
  59. (test
  60. NIL
  61. (unlock_aead
  62. (need 32 255)
  63. (need 12 77)
  64. (lock_aead
  65. (need 32 255)
  66. (need 12 77)
  67. NIL
  68. NIL )
  69. NIL ) )
  70. (do 1024
  71. (let
  72. (P (dh_generate (rand 1 8192))
  73. K (need 32 255)
  74. N (need 12 77)
  75. A (need (rand 1 4096) 255) )
  76. (setq @ (lock_aead K N P A))
  77. (test P (unlock_aead K N @ A)) ) )
  78. (test
  79. (48 15 107 246 211 98 231 65 217 227 172 232 229 158 34 177)
  80. (mac (1 2 3) (11 22 33)) )
  81. (test
  82. (43 240 18 246 125 48 121 117 233 216 101 48 212 150 16 14 79 145 13 105 42 123 228 36 148 210 181 37 184 109 139 93)
  83. (hash32 (11 22 33)) )
  84. (test
  85. (9 123 250 53 159 212 113 160 205 122 27 101 224 194 89 135 231 117 15 134 152 20 141 85 191 223 97 126 252 61 127 123)
  86. (hmac
  87. (96 226 109 174 243 39 239 192 46 195 53 226 160 37 210 208 22 235 66 6 248 114 119 245 45 56 209 152 139 120 205 54)
  88. (45 115 241 28 139 206 207 9 4 151 134 71 194 122 143 105 160 104 228 176 193 164 68 32 231 95 180 138 69 76 211 38) ) )
  89. (let C (1 2 3)
  90. (setq C (kdf1 C (need 6 7)))
  91. (test
  92. (104 211 53 248 136 243 74 213 47 230 238 96 86 2 208 13 17 230 139 226 151 190 109 137 226 234 120 218 246 184 131 157)
  93. C ) )
  94. (let
  95. (C (96 226 109 174 243 39 239 192 46 195 53 226 160 37 210 208 22 235 66 6 248 114 119 245 45 56 209 152 139 120 205 54)
  96. K NIL
  97. D (0 197 93 126 110 173 19 251 91 149 112 91 255 138 50 103 142 222 251 199 232 94 157 192 170 239 239 122 57 228 13 60) )
  98. (setq
  99. @ (kdf2 C D)
  100. C (car @)
  101. K (cadr @) )
  102. (test
  103. (38 209 211 59 116 167 34 230 182 32 217 36 179 40 108 45 250 101 151 185 118 86 16 5 153 171 254 172 32 126 3 123)
  104. C )
  105. (test
  106. (227 135 208 181 15 132 52 205 205 55 93 86 9 223 33 179 224 219 174 139 246 188 63 3 46 240 193 221 131 128 169 126)
  107. K ) )
  108. (let E (ephemrl-pair)
  109. (test
  110. (32 32)
  111. (mapcar length E) ) )
  112. (let
  113. (C (70 214 141 30 59 223 144 92 122 50 252 30 169 76 89 128 110 11 35 59 36 175 210 199 98 130 186 133 116 62 225 193)
  114. K (87 244 112 210 168 70 88 136 182 50 149 202 157 55 22 131 166 73 137 9 162 100 112 75 123 104 108 153 130 14 241 152)
  115. Pre NIL
  116. Data (22 144 178 135 11 61 115 28 22 161 94 49 16 187 95 38 248 201 55 236 208 85 19 200 74 89 81 90 7 168 165 81) )
  117. (setq
  118. @ (kdf3 C Data)
  119. C (car @)
  120. Pre (cadr @)
  121. K (caddr @) )
  122. (test
  123. (250 148 154 144 226 5 29 75 250 110 254 176 95 154 90 104 107 127 221 83 129 211 69 155 119 76 156 180 113 147 76 33)
  124. C )
  125. (test
  126. (29 246 187 72 100 247 102 47 99 251 1 33 78 117 143 251 14 24 206 112 71 251 177 187 75 51 174 0 113 166 9 8)
  127. Pre )
  128. (test
  129. (181 99 125 229 116 94 158 129 147 187 143 146 6 101 167 204 101 202 74 243 105 180 26 70 95 221 210 22 248 214 34 5)
  130. K ) )
  131. (test
  132. (0 0 0 0 21 129 233 125 244 16 34 17)
  133. (nonce 1234567890123456789) )
  134. (test
  135. (0 0 0 0 255 255 231 137 4 35 199 138)
  136. (nonce 9999999999999999999) )
  137. (test (big32 1234567) (flip (little32 1234567)))
  138. (test (flip (big64 12345678901234)) (little64 12345678901234))
  139. (msg 'OK-funcs)