Subject: CAVS test harness

Hi All,

We are working on a product that requires NIAP certification and use IPSec environment for certification. IPSec functionality is achieved by third party IPsec library and native XFRM.
Third party IPsec library is used for ISAKMP and XFRM for IPsec.

CAVS test cases are required for NIAP certification. Thus we need to implement CAVS test harness for Third party library and Linux crypto algorithms. I found the documentation on kernel crypto
API usage.

Please can you indication what is the right method to implement the test harness for Linux crypto algorithms.
1. Should I implement CAVS test harness for Linux kernel crypto algorithms as a user space application that exercise the kernel crypto API?
2. Should I implement CAVS test harness as module in Linux kernel?


Any information on this will help me very much on implementation.

Regards,
Jayalakshmi


2019-07-09 11:34:55

by Gilad Ben-Yossef

[permalink] [raw]
Subject: Re: CAVS test harness

On Tue, Jul 9, 2019 at 9:44 AM Bhat, Jayalakshmi Manjunath
<[email protected]> wrote:
>
> Hi All,
>
> We are working on a product that requires NIAP certification and use IPSec environment for certification. IPSec functionality is achieved by third party IPsec library and native XFRM.
> Third party IPsec library is used for ISAKMP and XFRM for IPsec.
>
> CAVS test cases are required for NIAP certification. Thus we need to implement CAVS test harness for Third party library and Linux crypto algorithms. I found the documentation on kernel crypto
> API usage.
>
> Please can you indication what is the right method to implement the test harness for Linux crypto algorithms.
> 1. Should I implement CAVS test harness for Linux kernel crypto algorithms as a user space application that exercise the kernel crypto API?
> 2. Should I implement CAVS test harness as module in Linux kernel?
>
>
> Any information on this will help me very much on implementation.

Are you sure the needed tests are not already implemented in the
kernel crypto API testmgr?

Gilad


--
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

Subject: RE: CAVS test harness

Hi Gilad,

Thank you very much for the response. I am an entry level engineer when it comes to Linux Kernel. I have gone through the testmgr. I am not very clear on how to use it for KAT (Known answer tests), MMT and MCT tests.
Also I am not clear on how to use it with various test vectors for AES, SHA, HMAC, DRBG and RSA

If you point me any example on how to use it, it will provide me a direction to use it.

Thanks in advance,
Jayalakshmi

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Gilad Ben-Yossef
Sent: Tuesday, July 09, 2019 5:04 PM
To: Bhat, Jayalakshmi Manjunath <[email protected]>
Cc: [email protected]
Subject: Re: CAVS test harness

On Tue, Jul 9, 2019 at 9:44 AM Bhat, Jayalakshmi Manjunath <[email protected]> wrote:
>
> Hi All,
>
> We are working on a product that requires NIAP certification and use IPSec environment for certification. IPSec functionality is achieved by third party IPsec library and native XFRM.
> Third party IPsec library is used for ISAKMP and XFRM for IPsec.
>
> CAVS test cases are required for NIAP certification. Thus we need to
> implement CAVS test harness for Third party library and Linux crypto algorithms. I found the documentation on kernel crypto API usage.
>
> Please can you indication what is the right method to implement the test harness for Linux crypto algorithms.
> 1. Should I implement CAVS test harness for Linux kernel crypto algorithms as a user space application that exercise the kernel crypto API?
> 2. Should I implement CAVS test harness as module in Linux kernel?
>
>
> Any information on this will help me very much on implementation.

Are you sure the needed tests are not already implemented in the kernel crypto API testmgr?

Gilad


--
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

2019-07-10 14:08:37

by Gilad Ben-Yossef

[permalink] [raw]
Subject: Re: CAVS test harness

On Tue, Jul 9, 2019 at 7:07 PM Bhat, Jayalakshmi Manjunath
<[email protected]> wrote:
>
> Hi Gilad,
>
> Thank you very much for the response. I am an entry level engineer when it comes to Linux Kernel. I have gone through the testmgr. I am not very clear on how to use it for KAT (Known answer tests), MMT and MCT tests.
> Also I am not clear on how to use it with various test vectors for AES, SHA, HMAC, DRBG and RSA
>
> If you point me any example on how to use it, it will provide me a direction to use it.


testmgr automatically runs KAT tests for every crypto protocol that
registers with the kernel at the time of registration. You don't have
to do anything for it to work (except avoiding disabling it - there is
a kernel config option to do that at build time but it is not the
default).
This is typically either at boot for statically built drivers or at
module load time for dynamically built drivers.

If the test fails the specific implementation of that crypto algorithm
will be disabled and if running in FIPS enforcement mode the entire
system will be shut down.

I am not sure what MMT and MCT tests are.

I hope this helped.
Gilad

2019-07-11 12:00:23

by Stephan Müller

[permalink] [raw]
Subject: Re: CAVS test harness

Am Donnerstag, 11. Juli 2019, 13:52:29 CEST schrieb Stephan Mueller:

Hi,

> Am Dienstag, 9. Juli 2019, 08:43:51 CEST schrieb Bhat, Jayalakshmi
> Manjunath:
>
> Hi Jayalakshmi,
>
> > Hi All,
> >
> > We are working on a product that requires NIAP certification and use IPSec
> > environment for certification. IPSec functionality is achieved by third
> > party IPsec library and native XFRM. Third party IPsec library is used
> > for
> > ISAKMP and XFRM for IPsec.
> >
> > CAVS test cases are required for NIAP certification. Thus we need to
> > implement CAVS test harness for Third party library and Linux crypto
> > algorithms. I found the documentation on kernel crypto API usage.
> >
> > Please can you indication what is the right method to implement the test
> > harness for Linux crypto algorithms.
> > 1. Should I implement CAVS test
> > harness for Linux kernel crypto algorithms as a user space application
> > that
> > exercise the kernel crypto API?
> > 2. Should I implement CAVS test harness as
> > module in Linux kernel?
>
> As I have implemented the full CAVS test framework I can tell you that the
> AF_ALG interface will not allow you to perform all tests required by CAVS.
>
> Thus you need to implement your own kernel module with its own interface.

As a side note: if you only want to test the symmetric ciphers and the hashes/
HMACs, you can implement that with libkcapi easily.

However, if you are interested in testing the DRBG due to its relevance for
the GCM IV, you certainly need a kernel module.
>
> > Any information on this will help me very much on implementation.
> >
> > Regards,
> > Jayalakshmi
>
> Ciao
> Stephan



Ciao
Stephan


2019-07-11 12:00:44

by Stephan Müller

[permalink] [raw]
Subject: Re: CAVS test harness

Am Dienstag, 9. Juli 2019, 13:34:21 CEST schrieb Gilad Ben-Yossef:

Hi Gilad,

> On Tue, Jul 9, 2019 at 9:44 AM Bhat, Jayalakshmi Manjunath
>
> <[email protected]> wrote:
> > Hi All,
> >
> > We are working on a product that requires NIAP certification and use IPSec
> > environment for certification. IPSec functionality is achieved by third
> > party IPsec library and native XFRM. Third party IPsec library is used
> > for ISAKMP and XFRM for IPsec.
> >
> > CAVS test cases are required for NIAP certification. Thus we need to
> > implement CAVS test harness for Third party library and Linux crypto
> > algorithms. I found the documentation on kernel crypto API usage.
> >
> > Please can you indication what is the right method to implement the test
> > harness for Linux crypto algorithms. 1. Should I implement CAVS test
> > harness for Linux kernel crypto algorithms as a user space application
> > that exercise the kernel crypto API? 2. Should I implement CAVS
> > test harness as module in Linux kernel?
> >
> >
> > Any information on this will help me very much on implementation.
>
> Are you sure the needed tests are not already implemented in the
> kernel crypto API testmgr?

The testmgr implements the power-on self tests required by FIPS 140-2. But
CAVS testing implies that there is a large set of test vectors which need to
be processed by the crypto implementations.

These test vectors are generated anew for each test round. Only the test
approach remains stable.
>
> Gilad



Ciao
Stephan


2019-07-11 12:05:43

by Stephan Müller

[permalink] [raw]
Subject: Re: CAVS test harness

Am Dienstag, 9. Juli 2019, 08:43:51 CEST schrieb Bhat, Jayalakshmi Manjunath:

Hi Jayalakshmi,

> Hi All,
>
> We are working on a product that requires NIAP certification and use IPSec
> environment for certification. IPSec functionality is achieved by third
> party IPsec library and native XFRM. Third party IPsec library is used for
> ISAKMP and XFRM for IPsec.
>
> CAVS test cases are required for NIAP certification. Thus we need to
> implement CAVS test harness for Third party library and Linux crypto
> algorithms. I found the documentation on kernel crypto API usage.
>
> Please can you indication what is the right method to implement the test
> harness for Linux crypto algorithms.
> 1. Should I implement CAVS test
> harness for Linux kernel crypto algorithms as a user space application that
> exercise the kernel crypto API?
> 2. Should I implement CAVS test harness as
> module in Linux kernel?

As I have implemented the full CAVS test framework I can tell you that the
AF_ALG interface will not allow you to perform all tests required by CAVS.

Thus you need to implement your own kernel module with its own interface.
>
>
> Any information on this will help me very much on implementation.
>
> Regards,
> Jayalakshmi



Ciao
Stephan


Subject: RE: CAVS test harness

Hi Stephan,

Thank you very much for the reply. Yes we would need to write the test for AEC (ECB,CBC,CTR) 128 and 256 bits, SHA-1, SHA-2 (256,384 and 512), HMAC, DRBG and also for key derivation functions.
We are planning to write netlink based kernel module to receive the data (test vector input) from the user space and process the data and generate the result, pass it on to user space.

I wanted to know if this sounds a reasonable approach?

Thanks in advance,
Jayalakshmi



-----Original Message-----
From: Stephan Mueller <[email protected]>
Sent: Thursday, July 11, 2019 5:30 PM
To: Bhat, Jayalakshmi Manjunath <[email protected]>
Cc: [email protected]
Subject: Re: CAVS test harness

Am Donnerstag, 11. Juli 2019, 13:52:29 CEST schrieb Stephan Mueller:

Hi,

> Am Dienstag, 9. Juli 2019, 08:43:51 CEST schrieb Bhat, Jayalakshmi
> Manjunath:
>
> Hi Jayalakshmi,
>
> > Hi All,
> >
> > We are working on a product that requires NIAP certification and use
> > IPSec environment for certification. IPSec functionality is achieved
> > by third party IPsec library and native XFRM. Third party IPsec
> > library is used for ISAKMP and XFRM for IPsec.
> >
> > CAVS test cases are required for NIAP certification. Thus we need
> > to implement CAVS test harness for Third party library and Linux
> > crypto algorithms. I found the documentation on kernel crypto API usage.
> >
> > Please can you indication what is the right method to implement the
> > test harness for Linux crypto algorithms.
> > 1. Should I implement CAVS test
> > harness for Linux kernel crypto algorithms as a user space
> > application that exercise the kernel crypto API?
> > 2. Should I implement CAVS test harness as
> > module in Linux kernel?
>
> As I have implemented the full CAVS test framework I can tell you that
> the AF_ALG interface will not allow you to perform all tests required by CAVS.
>
> Thus you need to implement your own kernel module with its own interface.

As a side note: if you only want to test the symmetric ciphers and the hashes/ HMACs, you can implement that with libkcapi easily.

However, if you are interested in testing the DRBG due to its relevance for the GCM IV, you certainly need a kernel module.
>
> > Any information on this will help me very much on implementation.
> >
> > Regards,
> > Jayalakshmi
>
> Ciao
> Stephan



Ciao
Stephan


2019-07-11 15:50:43

by Stephan Müller

[permalink] [raw]
Subject: Re: CAVS test harness

Am Donnerstag, 11. Juli 2019, 17:22:00 CEST schrieb Bhat, Jayalakshmi
Manjunath:

Hi Jayalakshmi,

> Hi Stephan,
>
> Thank you very much for the reply. Yes we would need to write the test for
> AEC (ECB,CBC,CTR) 128 and 256 bits, SHA-1, SHA-2 (256,384 and 512), HMAC,
> DRBG and also for key derivation functions. We are planning to write
> netlink based kernel module to receive the data (test vector input) from
> the user space and process the data and generate the result, pass it on to
> user space.
>
> I wanted to know if this sounds a reasonable approach?

That sounds reasonable.

I implemented the kernel module as you described it but with a debugfs
interface to use the interface straight from a shell if needed.

Ciao
Stephan


Subject: RE: CAVS test harness

Hi Stephan,

Thank you very much for the suggestions, I have another question, is it possible to implement MMT and MCT using kernel crypto API's. Also FCC and FCC functions.

Regards,
Jaya

-----Original Message-----
From: Stephan Mueller <[email protected]>
Sent: Thursday, July 11, 2019 9:04 PM
To: Bhat, Jayalakshmi Manjunath <[email protected]>
Cc: [email protected]
Subject: Re: CAVS test harness

Am Donnerstag, 11. Juli 2019, 17:22:00 CEST schrieb Bhat, Jayalakshmi
Manjunath:

Hi Jayalakshmi,

> Hi Stephan,
>
> Thank you very much for the reply. Yes we would need to write the test
> for AEC (ECB,CBC,CTR) 128 and 256 bits, SHA-1, SHA-2 (256,384 and
> 512), HMAC, DRBG and also for key derivation functions. We are
> planning to write netlink based kernel module to receive the data
> (test vector input) from the user space and process the data and
> generate the result, pass it on to user space.
>
> I wanted to know if this sounds a reasonable approach?

That sounds reasonable.

I implemented the kernel module as you described it but with a debugfs interface to use the interface straight from a shell if needed.

Ciao
Stephan


2019-07-12 18:35:51

by Eric Biggers

[permalink] [raw]
Subject: Re: CAVS test harness

On Fri, Jul 12, 2019 at 05:55:07PM +0000, Bhat, Jayalakshmi Manjunath wrote:
> Hi Stephan,
>
> Thank you very much for the suggestions, I have another question, is it possible to implement MMT and MCT using kernel crypto API's. Also FCC and FCC functions.
>
> Regards,
> Jaya
>

Please stop top posting.

I don't think you can implement Modern Monetary Theory, Medium-Chain
Triglycerides, or Federal Communications Commission functions using the Linux
kernel crypto API.

Of course, if those acronyms stand for something else, it would be helpful if
you'd explain what they are :-)

- Eric

2019-07-12 20:06:56

by Stephan Müller

[permalink] [raw]
Subject: Re: CAVS test harness

Am Freitag, 12. Juli 2019, 19:55:07 CEST schrieb Bhat, Jayalakshmi Manjunath:

Hi Jayalakshmi,

> Hi Stephan,
>
> Thank you very much for the suggestions, I have another question, is it
> possible to implement MMT and MCT using kernel crypto API's.

Yes, for sure - I have successfully implemented all CAVS tests for all ciphers
(see the CAVP validation list for the kernel crypto API).

> Also FCC and
> FCC functions.

I guess you mean FFC and ECC - yes, see the CAVP [2] web site.

Eric:

MCT - Monte Carlo Tests
MMT - Multi-Block Message Tests

In general, see [1] for all CAVS test specifications.

[1] https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program

[2] https://csrc.nist.rip/groups/STM/cavp/validation.html

Ciao
Stephan


Subject: RE: CAVS test harness

Hi Eric,

There are couple tests from NIST to verify the ciphers like AES, SHA etc to make sure that they are in compliance with NIST standards. Such tests are

KAT - known answer test
MMT - Multi-block Message Test
MCT - Monte Carlo Test
KAS FFC - Key Agreement Scheme, Finite Field Cryptography
KAC ECC - Elliptic Curve Cryptography

Hope this helps.

Regards,
Jaya




-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Eric Biggers
Sent: Saturday, July 13, 2019 12:05 AM
To: Bhat, Jayalakshmi Manjunath <[email protected]>
Cc: Stephan Mueller <[email protected]>; [email protected]
Subject: Re: CAVS test harness

On Fri, Jul 12, 2019 at 05:55:07PM +0000, Bhat, Jayalakshmi Manjunath wrote:
> Hi Stephan,
>
> Thank you very much for the suggestions, I have another question, is it possible to implement MMT and MCT using kernel crypto API's. Also FCC and FCC functions.
>
> Regards,
> Jaya
>

Please stop top posting.

I don't think you can implement Modern Monetary Theory, Medium-Chain Triglycerides, or Federal Communications Commission functions using the Linux kernel crypto API.

Of course, if those acronyms stand for something else, it would be helpful if you'd explain what they are :-)

- Eric

Subject: RE: CAVS test harness

Hi Stephan,

Thank you very much. I had done good amount of investigation. Since I am a new bee in this area, I wanted to confirm if my understanding is correct.

Thank you once again.

Regards,
Jayalakshmi

From: Stephan Mueller <[email protected]>
Sent: Saturday, July 13, 2019 1:35 AM
To: Bhat, Jayalakshmi Manjunath <[email protected]>
Cc: [email protected]
Subject: Re: CAVS test harness

Am Freitag, 12. Juli 2019, 19:55:07 CEST schrieb Bhat, Jayalakshmi Manjunath:

Hi Jayalakshmi,

> Hi Stephan,
>
> Thank you very much for the suggestions, I have another question, is it
> possible to implement MMT and MCT using kernel crypto API's.

Yes, for sure - I have successfully implemented all CAVS tests for all ciphers
(see the CAVP validation list for the kernel crypto API).

> Also FCC and
> FCC functions.

I guess you mean FFC and ECC - yes, see the CAVP [2] web site.

Eric:

MCT - Monte Carlo Tests
MMT - Multi-Block Message Tests

In general, see [1] for all CAVS test specifications.

[1] https://csrc.nist.gov/projects/cryptographic-algorithm-validation-program

[2] https://csrc.nist.rip/groups/STM/cavp/validation.html

Ciao
Stephan