mirage/mirage-crypto

Make mirage-crypto-ec (test) independent of mirage-crypto-pk

Closed this issue · 2 comments

As a quick fix for testing DKML and running the tests...

shouldn't be too hard, only the wycheproof stuff depends on:

let parse_sig cs =
  let asn = Asn.S.(sequence2 (required integer) (required integer)) in
  match Asn.(decode (codec der asn) cs) with
  | Error _ -> Error "ASN1 parse error"
  | Ok ((r, s), rest) ->
    if Cstruct.length rest <> 0 then Error "ASN1 leftover"
    else if Z.sign r < 0 || Z.sign s < 0 then
      Error "r and s must be >= 0"
    else
      Ok Mirage_crypto_pk.Z_extra.(to_cstruct_be r, to_cstruct_be s)

hmm, and a bit more asn...

fixed by #200