Cryptographic Interface header file for declaring common Quantum Safe methods.
More...
Go to the source code of this file.
|
struct | QS_CTX |
| Context structure to hold the appropriate quantum safe asymmetric keys. More...
|
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_cloneCtx (QS_CTX **ppNewCtx, QS_CTX *pCtx) |
| Clones a QS context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_deleteCtx (QS_CTX **ppCtx) |
| Deletes a QS context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_equalKey (QS_CTX *pCtx1, QS_CTX *pCtx2, byteBoolean *pRes) |
| Compares public key value of two QS contexts. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_generateKeyPair (QS_CTX *pCtx, RNGFun rngFun, void *pRngFunArg) |
| Generates a new key pair within a QS context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_getAlg (QS_CTX *pCtx, ubyte4 *pAlg) |
| Gets tha algorithm identifier from the context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_getPublicKey (QS_CTX *pCtx, ubyte *pPublicKey, ubyte4 pubLen) |
| Gets the public key from a QS context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_getPublicKeyAlloc (QS_CTX *pCtx, ubyte **ppPublicKey, ubyte4 *pPubLen) |
| Gets the public key from a QS context and allocates a buffer for it. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_getPublicKeyLen (QS_CTX *pCtx, ubyte4 *pPubLen) |
| Gets the length of a public key associated with a QS context in bytes. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_getPublicKeyLenFromAlgo (ubyte4 algo, ubyte4 *pPubLen) |
| Gets the length of a public key associated with a QS algorithm in bytes. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_newCtx (QS_CTX **ppNewCtx, ubyte4 algo) |
| Creates a new QS context. More...
|
|
MOC_EXTERN MSTATUS | CRYPTO_INTERFACE_QS_setPublicKey (QS_CTX *pCtx, ubyte *pPublicKey, ubyte4 pubLen) |
| Sets the public key within a QS context. More...
|
|
◆ CRYPTO_INTERFACE_QS_cloneCtx()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_cloneCtx |
( |
QS_CTX ** |
ppNewCtx, |
|
|
QS_CTX * |
pCtx |
|
) |
| |
Clones a new QS context from an existing context. Be sure to call CRYPTO_INTERFACE_QS_deleteCtx
to free memory when done with the new context.
- Parameters
-
ppNewCtx | Pointer to the location that will contain the newly allocated clone of the original context. |
pCtx | Pointer to the existing context to be cloned. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_deleteCtx()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_deleteCtx |
( |
QS_CTX ** |
ppCtx | ) |
|
Deletes a QS context including freeing internal keys and memory allocated for the context itself.
- Parameters
-
ppCtx | Pointer to the location of the context to be deleted. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_equalKey()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_equalKey |
( |
QS_CTX * |
pCtx1, |
|
|
QS_CTX * |
pCtx2, |
|
|
byteBoolean * |
pRes |
|
) |
| |
Compares public key value of two QS contexts.
- Parameters
-
pCtx1 | Pointer to the first QS context. |
pCtx2 | Pointer to the second QS context. |
pRes | Returns TRUE if public keys match, else FALSE. |
pubLen | The length of the public key in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_generateKeyPair()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_generateKeyPair |
( |
QS_CTX * |
pCtx, |
|
|
RNGFun |
rngFun, |
|
|
void * |
pRngFunArg |
|
) |
| |
Generates a new key pair within a QS context.
- Parameters
-
pCtx | Pointer to the QS context that will hold the new keys. |
rngFun | Function pointer to a random number generation function. |
pRngFunArg | Input data or context into the random number generation function pointer. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_getAlg()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_getAlg |
( |
QS_CTX * |
pCtx, |
|
|
ubyte4 * |
pAlg |
|
) |
| |
Gets tha algorithm identifier from the context.
- Parameters
-
pCtx | Pointer to a previously allocated context. |
pAlg | Contents Will be set to the algorithm identifier macro value. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_getPublicKey()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_getPublicKey |
( |
QS_CTX * |
pCtx, |
|
|
ubyte * |
pPublicKey, |
|
|
ubyte4 |
pubLen |
|
) |
| |
Gets the public key from a QS context.
- Parameters
-
pCtx | Pointer to the QS context that contains at least a public key. |
pPublicKey | Buffer to hold the resulting public key. |
pubLen | The length of the pPublicKey buffer in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_getPublicKeyAlloc()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_getPublicKeyAlloc |
( |
QS_CTX * |
pCtx, |
|
|
ubyte ** |
ppPublicKey, |
|
|
ubyte4 * |
pPubLen |
|
) |
| |
Gets the public key from a QS context. A buffer is allocated to hold the public key. Be sure to free this buffer when done with it.
- Parameters
-
pCtx | Pointer to the QS context that contains at least a public key. |
ppPublicKey | Pointer to the location that will receive the newly allocated buffer. |
pPubLen | Contents will be set to the length of the public key in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_getPublicKeyLen()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_getPublicKeyLen |
( |
QS_CTX * |
pCtx, |
|
|
ubyte4 * |
pPubLen |
|
) |
| |
Gets the length of a public key associated with a QS context in bytes.
- Parameters
-
pCtx | Pointer to the QS context. |
pPubLen | Contents will be set to the length of the public key in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_getPublicKeyLenFromAlgo()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_getPublicKeyLenFromAlgo |
( |
ubyte4 |
algo, |
|
|
ubyte4 * |
pPubLen |
|
) |
| |
Gets the length of a public key associated with a QS algorithm in bytes.
- Parameters
-
algo | The algorithm identifier. |
pPubLen | Contents will be set to the length of the public key in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_newCtx()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_newCtx |
( |
QS_CTX ** |
ppNewCtx, |
|
|
ubyte4 |
algo |
|
) |
| |
Creates a new QS context including allocation of the internal key shells. Be sure to call CRYPTO_INTERFACE_QS_deleteCtx
to free memory when done with the context.
- Parameters
-
ppNewCtx | Pointer to the location that will contain the newly allocated context. |
algo | One of the algorithm flags to indicate which algorithm will be performed,. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.
◆ CRYPTO_INTERFACE_QS_setPublicKey()
MOC_EXTERN MSTATUS CRYPTO_INTERFACE_QS_setPublicKey |
( |
QS_CTX * |
pCtx, |
|
|
ubyte * |
pPublicKey, |
|
|
ubyte4 |
pubLen |
|
) |
| |
Sets the public key within a QS context.
- Parameters
-
pCtx | Pointer to the QS context. |
pPublicKey | Buffer holding the public key to be set. |
pubLen | The length of the public key in bytes. |
- Returns
OK
(0) if successful, otherwise a negative number error code from merrors.h.