decryptForFuzzing parses data as XML and decrypts its root element with key. It is what the fuzz tests exercise.
(key *rsa.PrivateKey, data []byte)
| 120 | // decryptForFuzzing parses data as XML and decrypts its root element with |
| 121 | // key. It is what the fuzz tests exercise. |
| 122 | func decryptForFuzzing(key *rsa.PrivateKey, data []byte) error { |
| 123 | doc := etree.NewDocument() |
| 124 | if err := doc.ReadFromBytes(data); err != nil { |
| 125 | return err |
| 126 | } |
| 127 | if doc.Root() == nil { |
| 128 | return ErrCannotFindRequiredElement("root element") |
| 129 | } |
| 130 | _, err := Decrypt(key, doc.Root()) |
| 131 | return err |
| 132 | } |
| 133 | |
| 134 | // FuzzDecrypt fuzzes Decrypt with hostile documents, seeded with the corpus |
| 135 | // and past crashers of the retired go-fuzz harness. Run it with |
no test coverage detected