|
ReactOS 0.4.17-dev-1005-g171e1de
|
#include "precomp.h"
Go to the source code of this file.
Variables | |
| const UINT32 | SYMCRYPT_MLKEM_Rlog2 = 16 |
| const UINT32 | SYMCRYPT_MLKEM_Rmask = 0xffff |
| const UINT32 | SYMCRYPT_MLKEM_NegQInvModR = 3327 |
| const UINT32 | SYMCRYPT_MLKEM_Rsqr = 1353 |
| const UINT32 | SYMCRYPT_MLKEM_RsqrTimesNegQInvModR = 44983 |
| const UINT16 | MlKemZetaBitRevTimesR [128] |
| const UINT16 | MlKemZetaBitRevTimesRTimesNegQInvModR [128] |
| const UINT16 | zetaTwoTimesBitRevPlus1TimesR [128] |
| const UINT32 | SYMCRYPT_MLKEM_INTTFixupTimesRsqr = 1441 |
| const UINT32 | SYMCRYPT_MLKEM_INTTFixupTimesRsqrTimesNegQInvModR = 10079 |
| const UINT32 | SYMCRYPT_MLKEM_COMPRESS_MULCONSTANT = 0x275f6f |
| const UINT32 | SYMCRYPT_MLKEM_COMPRESS_SHIFTCONSTANT = 33 |
| #define SYMCRYPT_MLKEM_MaxA1B1ZetaPow (SYMCRYPT_MLKEM_MaxFirstStepReduction*SYMCRYPT_MLKEM_MaxZetaTwoTimesPlus1TimesR) |
Definition at line 687 of file mlkem_primitives.c.
| #define SYMCRYPT_MLKEM_MaxCoeff (SYMCRYPT_MLKEM_Q - 1) |
Definition at line 680 of file mlkem_primitives.c.
| #define SYMCRYPT_MLKEM_MaxCoeffProduct (SYMCRYPT_MLKEM_MaxCoeff*SYMCRYPT_MLKEM_MaxCoeff) |
Definition at line 681 of file mlkem_primitives.c.
| #define SYMCRYPT_MLKEM_MaxFirstStepReduction (3494) |
Definition at line 684 of file mlkem_primitives.c.
| #define SYMCRYPT_MLKEM_MaxZetaTwoTimesPlus1TimesR (3254) |
Definition at line 686 of file mlkem_primitives.c.
| VOID SYMCRYPT_CALL SymCryptMlKemkeyWipePrivateState | ( | _Inout_ PSYMCRYPT_MLKEMKEY | pkMlKemkey | ) |
Definition at line 1426 of file mlkem_primitives.c.
| PSYMCRYPT_MLKEM_MATRIX SYMCRYPT_CALL SymCryptMlKemMatrixCreate | ( | _Out_writes_bytes_(cbBuffer) PBYTE | pbBuffer, |
| UINT32 | cbBuffer, | ||
| UINT32 | nRows | ||
| ) |
Definition at line 196 of file mlkem_primitives.c.
Referenced by SymCryptMlKemkeyInitialize().
| VOID SYMCRYPT_CALL SymCryptMlKemMatrixTranspose | ( | _Inout_ PSYMCRYPT_MLKEM_MATRIX | pmSrc | ) |
Definition at line 1152 of file mlkem_primitives.c.
Referenced by SymCryptMlKemkeyExpandFromPrivateSeed(), and SymCryptMlKemkeySetValue().
| VOID SYMCRYPT_CALL SymCryptMlKemMatrixVectorMontMulAndAdd | ( | _In_ PCSYMCRYPT_MLKEM_MATRIX | pmSrc1, |
| _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc2, | ||
| _Inout_ PSYMCRYPT_MLKEM_VECTOR | pvDst, | ||
| _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT_ACCUMULATOR | paTmp | ||
| ) |
Definition at line 1175 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemkeyExpandFromPrivateSeed().
| FORCEINLINE UINT32 SYMCRYPT_CALL SymCryptMlKemModAdd | ( | UINT32 | a, |
| UINT32 | b | ||
| ) |
Definition at line 483 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementAdd(), SymCryptMlKemPolyElementINTTLayerC(), and SymCryptMlKemPolyElementNTTLayerC().
| FORCEINLINE UINT32 SYMCRYPT_CALL SymCryptMlKemModSub | ( | UINT32 | a, |
| UINT32 | b | ||
| ) |
Definition at line 503 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMontMul(), SymCryptMlKemPolyElementDecodeAndDecompress(), SymCryptMlKemPolyElementINTTLayerC(), SymCryptMlKemPolyElementNTTLayerC(), and SymCryptMlKemPolyElementSub().
| VOID SYMCRYPT_CALL SymCryptMlKemMontgomeryReduceAndAddPolyElementAccumulatorToPolyElement | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT_ACCUMULATOR | paSrc, |
| _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 758 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMatrixVectorMontMulAndAdd(), and SymCryptMlKemVectorMontDotProduct().
| FORCEINLINE UINT32 SYMCRYPT_CALL SymCryptMlKemMontMul | ( | UINT32 | a, |
| UINT32 | b, | ||
| UINT32 | bMont | ||
| ) |
Definition at line 523 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTAndMulR(), SymCryptMlKemPolyElementINTTLayerC(), SymCryptMlKemPolyElementMulR(), and SymCryptMlKemPolyElementNTTLayerC().
| PSYMCRYPT_MLKEM_POLYELEMENT_ACCUMULATOR SYMCRYPT_CALL SymCryptMlKemPolyElementAccumulatorCreate | ( | _Out_writes_bytes_(cbBuffer) PBYTE | pbBuffer, |
| UINT32 | cbBuffer | ||
| ) |
Definition at line 140 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemkeyExpandFromPrivateSeed().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementAdd | ( | _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc1, |
| _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc2, | ||
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 811 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemVectorAdd().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementCompressAndEncode | ( | _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| UINT32 | nBitsPerCoefficient, | ||
| _Out_writes_bytes_(nBitsPerCoefficient *(SYMCRYPT_MLWE_POLYNOMIAL_COEFFICIENTS/8)) PBYTE | pbDst | ||
| ) |
Definition at line 890 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemVectorCompressAndEncode().
| PSYMCRYPT_MLKEM_POLYELEMENT SYMCRYPT_CALL SymCryptMlKemPolyElementCreate | ( | _Out_writes_bytes_(cbBuffer) PBYTE | pbBuffer, |
| UINT32 | cbBuffer | ||
| ) |
Definition at line 124 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), SymCryptMlKemMatrixCreate(), and SymCryptMlKemVectorCreate().
| SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptMlKemPolyElementDecodeAndDecompress | ( | _In_reads_bytes_(nBitsPerCoefficient *(SYMCRYPT_MLWE_POLYNOMIAL_COEFFICIENTS/8)) PCBYTE | pbSrc, |
| UINT32 | nBitsPerCoefficient, | ||
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 963 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemVectorDecodeAndDecompress().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementINTTAndMulR | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc | ) |
Definition at line 859 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemVectorINTTAndMulR().
| FORCEINLINE VOID SYMCRYPT_CALL SymCryptMlKemPolyElementINTTLayer | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| UINT32 | k, | ||
| UINT32 | len | ||
| ) |
Definition at line 647 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTAndMulR().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementINTTLayerC | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| UINT32 | k, | ||
| UINT32 | len | ||
| ) |
Definition at line 578 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTLayer().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementMulAndAccumulate | ( | _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc1, |
| _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc2, | ||
| _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT_ACCUMULATOR | paDst | ||
| ) |
Definition at line 691 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMatrixVectorMontMulAndAdd(), and SymCryptMlKemVectorMontDotProduct().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementMulR | ( | _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 797 of file mlkem_primitives.c.
Referenced by SymCryptMlKemVectorMulR().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementNTT | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc | ) |
Definition at line 839 of file mlkem_primitives.c.
Referenced by SymCryptMlKemVectorNTT().
| FORCEINLINE VOID SYMCRYPT_CALL SymCryptMlKemPolyElementNTTLayer | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| UINT32 | k, | ||
| UINT32 | len | ||
| ) |
Definition at line 611 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementNTT().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementNTTLayerC | ( | _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peSrc, |
| UINT32 | k, | ||
| UINT32 | len | ||
| ) |
Definition at line 546 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementNTTLayer().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementSampleCBDFromBytes | ( | _In_reads_bytes_(eta *2 *(SYMCRYPT_MLWE_POLYNOMIAL_COEFFICIENTS/8)+1) PCBYTE | pbSrc, |
| _In_range_(2, 3) UINT32 | eta, | ||
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 1081 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemkeyExpandFromPrivateSeed().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementSampleNTTFromShake128 | ( | _Inout_ PSYMCRYPT_SHAKE128_STATE | pState, |
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 1046 of file mlkem_primitives.c.
Referenced by SymCryptMlKemkeyExpandPublicMatrixFromPublicSeed().
| VOID SYMCRYPT_CALL SymCryptMlKemPolyElementSub | ( | _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc1, |
| _In_ PCSYMCRYPT_MLKEM_POLYELEMENT | peSrc2, | ||
| _Out_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst | ||
| ) |
Definition at line 825 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), and SymCryptMlKemVectorSub().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorAdd | ( | _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc1, |
| _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc2, | ||
| _Out_ PSYMCRYPT_MLKEM_VECTOR | pvDst | ||
| ) |
Definition at line 1276 of file mlkem_primitives.c.
| VOID SYMCRYPT_CALL SymCryptMlKemVectorCompressAndEncode | ( | _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc, |
| UINT32 | nBitsPerCoefficient, | ||
| _Out_writes_bytes_(cbDst) PBYTE | pbDst, | ||
| SIZE_T | cbDst | ||
| ) |
Definition at line 1362 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal(), SymCryptMlKemkeyExpandFromPrivateSeed(), and SymCryptMlKemkeyGetValue().
| PSYMCRYPT_MLKEM_VECTOR SYMCRYPT_CALL SymCryptMlKemVectorCreate | ( | _Out_writes_bytes_(cbBuffer) PBYTE | pbBuffer, |
| UINT32 | cbBuffer, | ||
| UINT32 | nRows | ||
| ) |
Definition at line 156 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), SymCryptMlKemkeyExpandFromPrivateSeed(), and SymCryptMlKemkeyInitialize().
| SYMCRYPT_ERROR SYMCRYPT_CALL SymCryptMlKemVectorDecodeAndDecompress | ( | _In_reads_bytes_(cbSrc) PCBYTE | pbSrc, |
| SIZE_T | cbSrc, | ||
| UINT32 | nBitsPerCoefficient, | ||
| _Out_ PSYMCRYPT_MLKEM_VECTOR | pvDst | ||
| ) |
Definition at line 1390 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), and SymCryptMlKemkeySetValue().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorINTTAndMulR | ( | _Inout_ PSYMCRYPT_MLKEM_VECTOR | pvSrc | ) |
Definition at line 1345 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorMontDotProduct | ( | _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc1, |
| _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc2, | ||
| _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT | peDst, | ||
| _Inout_ PSYMCRYPT_MLKEM_POLYELEMENT_ACCUMULATOR | paTmp | ||
| ) |
Definition at line 1211 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), and SymCryptMlKemEncapsulateInternal().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorMulR | ( | _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc, |
| _Out_ PSYMCRYPT_MLKEM_VECTOR | pvDst | ||
| ) |
Definition at line 1255 of file mlkem_primitives.c.
Referenced by SymCryptMlKemkeyExpandFromPrivateSeed().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorNTT | ( | _Inout_ PSYMCRYPT_MLKEM_VECTOR | pvSrc | ) |
Definition at line 1328 of file mlkem_primitives.c.
Referenced by SymCryptMlKemDecapsulate(), SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemkeyExpandFromPrivateSeed().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorSetZero | ( | _Inout_ PSYMCRYPT_MLKEM_VECTOR | pvSrc | ) |
Definition at line 1242 of file mlkem_primitives.c.
Referenced by SymCryptMlKemEncapsulateInternal(), and SymCryptMlKemkeyWipePrivateState().
| VOID SYMCRYPT_CALL SymCryptMlKemVectorSub | ( | _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc1, |
| _In_ PCSYMCRYPT_MLKEM_VECTOR | pvSrc2, | ||
| _Out_ PSYMCRYPT_MLKEM_VECTOR | pvDst | ||
| ) |
Definition at line 1302 of file mlkem_primitives.c.
Definition at line 54 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTLayerC(), and SymCryptMlKemPolyElementNTTLayerC().
Definition at line 78 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTLayerC(), and SymCryptMlKemPolyElementNTTLayerC().
Definition at line 885 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementCompressAndEncode().
Definition at line 886 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementCompressAndEncode().
Definition at line 854 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTAndMulR().
Definition at line 855 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementINTTAndMulR().
Definition at line 34 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMontgomeryReduceAndAddPolyElementAccumulatorToPolyElement(), SymCryptMlKemMontMul(), and SymCryptMlKemPolyElementMulAndAccumulate().
Definition at line 30 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMontgomeryReduceAndAddPolyElementAccumulatorToPolyElement(), SymCryptMlKemMontMul(), and SymCryptMlKemPolyElementMulAndAccumulate().
Definition at line 31 of file mlkem_primitives.c.
Referenced by SymCryptMlKemMontgomeryReduceAndAddPolyElementAccumulatorToPolyElement(), SymCryptMlKemMontMul(), and SymCryptMlKemPolyElementMulAndAccumulate().
Definition at line 37 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementMulR().
Definition at line 39 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementMulR().
Definition at line 102 of file mlkem_primitives.c.
Referenced by SymCryptMlKemPolyElementMulAndAccumulate().