[Openvpn-devel,0/4] Add some tests for cryptoapi.c functions

Message ID 20230315013516.1256700-1-selva.nair@gmail.com
Headers show
Series Add some tests for cryptoapi.c functions | expand

Message

Selva Nair March 15, 2023, 1:35 a.m. UTC
From: Selva Nair <selva.nair@gmail.com>

  Import some sample certificates into Windows store for testing
    - 4 test certificates&keys imported to user store
      and removed at the end.

  Add tests for finding certificates in Windows certficate store
    - test using SUBJ:, THUMB: and ISSUER: select-strings

  Refactor SSL_CTX_use_CryptoAPI_certificate()
    - A minor reorganization avoids wrapping for the next test

  Add a test for signing with certificates in Windows store
    - Test loading keys into xkey-provider and sign a test message.
      The signature is then verified using OpenSSL.

Sample output the test runs:
https://github.com/selvanair/openvpn/actions/runs/4418774866/jobs/7746404938#step:8:1

 src/openvpn/cryptoapi.c                   |  63 ++--
 tests/unit_tests/openvpn/Makefile.am      |   1 +
 tests/unit_tests/openvpn/cert_data.h      | 166 +++++++++
 tests/unit_tests/openvpn/test_cryptoapi.c | 429 +++++++++++++++++++++-
 4 files changed, 635 insertions(+), 24 deletions(-)
 create mode 100644 tests/unit_tests/openvpn/cert_data.h

Comments

Gert Doering March 15, 2023, 8:30 a.m. UTC | #1
Hi,

On Tue, Mar 14, 2023 at 09:35:12PM -0400, selva.nair@gmail.com wrote:
> From: Selva Nair <selva.nair@gmail.com>
> 
>   Import some sample certificates into Windows store for testing
>     - 4 test certificates&keys imported to user store
>       and removed at the end.
[..]

This is extremely valuable.  Thanks.

If I apply these 4 patches on top of "master", will the test then succeed,
or will it show failure due to the not-yet-merged padding patch?

gert
Selva Nair March 15, 2023, 1:18 p.m. UTC | #2
On Wed, Mar 15, 2023 at 4:30 AM Gert Doering <gert@greenie.muc.de> wrote:

> Hi,
>
> On Tue, Mar 14, 2023 at 09:35:12PM -0400, selva.nair@gmail.com wrote:
> > From: Selva Nair <selva.nair@gmail.com>
> >
> >   Import some sample certificates into Windows store for testing
> >     - 4 test certificates&keys imported to user store
> >       and removed at the end.
> [..]
>
> This is extremely valuable.  Thanks.
>
> If I apply these 4 patches on top of "master", will the test then succeed,
> or will it show failure due to the not-yet-merged padding patch?
>

As cryptoapi works correctly without the padding patch (only PKCS11 was
affected), and this tests only exercises those bits should work without the
padding patch. Though I tested it only with both included.

Selva