On Mon, Apr 11, 2022 at 06:43:26PM +0800, zhenwei pi wrote: > From: lei he <helei.sig11@xxxxxxxxxxxxx> > > Add unit test and benchmark test for crypto akcipher. > > Signed-off-by: lei he <helei.sig11@xxxxxxxxxxxxx> > Signed-off-by: zhenwei pi <pizhenwei@xxxxxxxxxxxxx> > --- > tests/bench/benchmark-crypto-akcipher.c | 161 ++++++ > tests/bench/meson.build | 4 + > tests/bench/test_akcipher_keys.inc | 537 ++++++++++++++++++ > tests/unit/meson.build | 1 + > tests/unit/test-crypto-akcipher.c | 708 ++++++++++++++++++++++++ > 5 files changed, 1411 insertions(+) > create mode 100644 tests/bench/benchmark-crypto-akcipher.c > create mode 100644 tests/bench/test_akcipher_keys.inc > create mode 100644 tests/unit/test-crypto-akcipher.c > > diff --git a/tests/bench/test_akcipher_keys.inc b/tests/bench/test_akcipher_keys.inc > new file mode 100644 > index 0000000000..7adf218135 > --- /dev/null > +++ b/tests/bench/test_akcipher_keys.inc > @@ -0,0 +1,537 @@ > +/* > + * Copyright (c) 2022 Bytedance, and/or its affiliates > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + * Author: lei he <helei.sig11@xxxxxxxxxxxxx> > + */ > + > +/* RSA test keys, generated by OpenSSL */ > +static const uint8_t rsa1024_priv_key[] = { > + 0x30, 0x82, 0x02, 0x5c, 0x02, 0x01, 0x00, 0x02, > + 0x81, 0x81, 0x00, 0xe6, 0x4d, 0x76, 0x4f, 0xb2, snip For the patch as is: Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> It could be nice to add another test with some intentionally corrupt RSA keys with bad DER encoding, as a way to prove that we're handling errors in DER decoding correctly when faced with malicous data from a bad guest. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|