ISARA Radiate Security Solution Suite Toolkit Edition Version 1.5

Quantum-safe cryptographic primitives and algorithms.

iqr_sidh.h File Reference

ISARA Radiate Security Solution Suite's Supersingular Isogeny Diffie-Hellman (SIDH). More...

Typedefs

typedef struct iqr_SIDHParams_struct iqr_SIDHParams
 
typedef struct iqr_SIDHAlicePrivateKey_struct iqr_SIDHAlicePrivateKey
 
typedef struct iqr_SIDHBobPrivateKey_struct iqr_SIDHBobPrivateKey
 
typedef struct iqr_SIDHVariant_struct iqr_SIDHVariant
 

Functions

IQR_API iqr_retval iqr_SIDHCreateParams (const iqr_Context *ctx, const iqr_SIDHVariant *variant, iqr_SIDHParams **params)
 
IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyParams (iqr_SIDHParams **params)
 
IQR_API iqr_retval iqr_SIDHGetPublicKeySize (const iqr_SIDHParams *params, size_t *public_key_size)
 
IQR_API iqr_retval iqr_SIDHGetSecretSize (const iqr_SIDHParams *params, size_t *secret_size)
 
IQR_API iqr_retval iqr_SIDHCreateAlicePrivateKey (const iqr_SIDHParams *params, const iqr_RNG *rng, iqr_SIDHAlicePrivateKey **alice_private_key)
 
IQR_API iqr_retval iqr_SIDHCreateBobPrivateKey (const iqr_SIDHParams *params, const iqr_RNG *rng, iqr_SIDHBobPrivateKey **bob_private_key)
 
IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyAlicePrivateKey (iqr_SIDHAlicePrivateKey **alice_private_key)
 
IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyBobPrivateKey (iqr_SIDHBobPrivateKey **bob_private_key)
 
IQR_API iqr_retval iqr_SIDHGetAlicePublicKey (const iqr_SIDHAlicePrivateKey *alice_private_key, uint8_t *alice_public_key, size_t alice_public_key_size)
 
IQR_API iqr_retval iqr_SIDHGetBobPublicKey (const iqr_SIDHBobPrivateKey *bob_private_key, uint8_t *bob_public_key, size_t bob_public_key_size)
 
IQR_API iqr_retval iqr_SIDHGetAliceSecret (const iqr_SIDHAlicePrivateKey *alice_private_key, const uint8_t *bob_public_key, size_t bob_public_key_size, uint8_t *secret, size_t secret_size)
 
IQR_API iqr_retval iqr_SIDHGetBobSecret (const iqr_SIDHBobPrivateKey *bob_private_key, const uint8_t *alice_public_key, size_t alice_public_key_size, uint8_t *secret, size_t secret_size)
 

Variables

IQR_EXTERN const iqr_SIDHVariant IQR_SIDH_P503
 
IQR_EXTERN const iqr_SIDHVariant IQR_SIDH_P751
 

Typedef Documentation

◆ iqr_SIDHAlicePrivateKey

typedef struct iqr_SIDHAlicePrivateKey_struct iqr_SIDHAlicePrivateKey

Alice's private key.

◆ iqr_SIDHBobPrivateKey

typedef struct iqr_SIDHBobPrivateKey_struct iqr_SIDHBobPrivateKey

Bob's private key.

◆ iqr_SIDHParams

typedef struct iqr_SIDHParams_struct iqr_SIDHParams

The algorithm's domain parameters.

◆ iqr_SIDHVariant

typedef struct iqr_SIDHVariant_struct iqr_SIDHVariant

The SIDH variant. This controls the amount of security.

Function Documentation

◆ iqr_SIDHCreateAlicePrivateKey()

IQR_API iqr_retval iqr_SIDHCreateAlicePrivateKey ( const iqr_SIDHParams params,
const iqr_RNG rng,
iqr_SIDHAlicePrivateKey **  alice_private_key 
)

Create Alice's SIDH private key to be used during shared secret generation.

Note
Create a private key before calling iqr_SIDHGetAlicePublicKey(). The resulting key can only be used for generating a single shared secret. That means calling iqr_SIDHDestroyAlicePrivateKey() after iqr_SIDHGetAliceSecret() or when iqr_SIDHGetAlicePublicKey() fails.

*alice_private_key must be NULL.

Parameters
[in]paramsThe iqr_SIDHParams to use.
[in]rngA seeded random number generator.
[out]alice_private_keyUsed to store Alice's private key.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHCreateBobPrivateKey()

IQR_API iqr_retval iqr_SIDHCreateBobPrivateKey ( const iqr_SIDHParams params,
const iqr_RNG rng,
iqr_SIDHBobPrivateKey **  bob_private_key 
)

Create Bob's SIDH private key to be used during shared secret generation.

Note
Create a private key before calling iqr_SIDHGetBobPublicKey(). The resulting key can only be used for generating a single shared secret. That means calling iqr_SIDHDestroyBobPrivateKey() after iqr_SIDHGetBobSecret() or when iqr_SIDHGetBobPublicKey() fails.

*bob_private_key must be NULL.

Parameters
[in]paramsThe iqr_SIDHParams to use.
[in]rngA seeded random number generator.
[out]bob_private_keyUsed to store Bob's private key.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHCreateParams()

IQR_API iqr_retval iqr_SIDHCreateParams ( const iqr_Context ctx,
const iqr_SIDHVariant variant,
iqr_SIDHParams **  params 
)

Create an SIDH Parameters object that encapsulates the domain parameters.

It's up to the user to manage domain parameters; the parameter data is not exposed in stored keys or secrets.

*params must be set to NULL before calling iqr_SIDHCreateParams().

Parameters
[in]ctxA Context object.
[in]variantThe iqr_SIDHVariant to use.
[out]paramsThe iqr_SIDHParams output.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHDestroyAlicePrivateKey()

IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyAlicePrivateKey ( iqr_SIDHAlicePrivateKey **  alice_private_key)

Clear and deallocate Alice's SIDH private key.

*alice_private_key will be set to NULL prior to returning.

The private key's data is cleared before its internal buffers are deallocated.

Parameters
[in,out]alice_private_keyAlice's private key to destroy.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHDestroyBobPrivateKey()

IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyBobPrivateKey ( iqr_SIDHBobPrivateKey **  bob_private_key)

Clear and deallocate Bob's SIDH private key.

*bob_private_key will be set to NULL prior to returning.

The private key's data is cleared before its internal buffers are deallocated.

Parameters
[in,out]bob_private_keyBob's private key to destroy.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHDestroyParams()

IQR_API_UNENFORCED_RETURN iqr_retval iqr_SIDHDestroyParams ( iqr_SIDHParams **  params)

Clear and deallocate an SIDH Parameter object.

*params will be set to NULL prior to returning.

All internal iqr_SIDHParams buffers are cleared and deallocated during the call to iqr_SIDHDestroyParams(). The iqr_SIDHParams object does not store any cryptographic material.

Parameters
[in,out]paramsThe iqr_SIDHParams instance to destroy.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetAlicePublicKey()

IQR_API iqr_retval iqr_SIDHGetAlicePublicKey ( const iqr_SIDHAlicePrivateKey alice_private_key,
uint8_t *  alice_public_key,
size_t  alice_public_key_size 
)

Get Alice's public key which is needed for SIDH key agreement.

Parameters
[in]alice_private_keyAlice's private key.
[out]alice_public_keyThe public key generated by Alice.
[in]alice_public_key_sizeThe size of alice_public_key in bytes. Must be exactly the size returned by iqr_SIDHGetPublicKeySize().
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetAliceSecret()

IQR_API iqr_retval iqr_SIDHGetAliceSecret ( const iqr_SIDHAlicePrivateKey alice_private_key,
const uint8_t *  bob_public_key,
size_t  bob_public_key_size,
uint8_t *  secret,
size_t  secret_size 
)

Get Alice's shared secret.

Note
The output secret is a shared secret, not a key. This output must be passed through a KDF or hash function before being used. Do not use this secret directly.

All internal buffers are cleared and deallocated before the call to iqr_SIDHGetAliceSecret() returns. Be sure to safely wipe and deallocate the secret when you're done with it.

Parameters
[in]alice_private_keyAlice's private key.
[in]bob_public_keyThe public key generated by Bob.
[in]bob_public_key_sizeThe size of bob_public_key in bytes. Must be exactly the size returned by iqr_SIDHGetPublicKeySize().
[out]secretThe shared secret.
[in]secret_sizeThe size of secret in bytes. Must be exactly the size returned by iqr_SIDHGetSecretSize().
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetBobPublicKey()

IQR_API iqr_retval iqr_SIDHGetBobPublicKey ( const iqr_SIDHBobPrivateKey bob_private_key,
uint8_t *  bob_public_key,
size_t  bob_public_key_size 
)

Get Bob's public key which is needed for SIDH key agreement.

Parameters
[in]bob_private_keyBob's private key.
[out]bob_public_keyThe public key generated by Bob.
[in]bob_public_key_sizeThe size of bob_public_key in bytes. Must be exactly the size returned by iqr_SIDHGetPublicKeySize().
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetBobSecret()

IQR_API iqr_retval iqr_SIDHGetBobSecret ( const iqr_SIDHBobPrivateKey bob_private_key,
const uint8_t *  alice_public_key,
size_t  alice_public_key_size,
uint8_t *  secret,
size_t  secret_size 
)

Get Bob's shared secret.

Note
The output secret is a shared secret, not a key. This output must be passed through a KDF or hash function before being used. Do not use this secret directly.

All internal buffers are cleared and deallocated before the call to iqr_SIDHGetBobSecret() returns. Be sure to safely wipe and deallocate the secret when you're done with it.

Parameters
[in]bob_private_keyBob's private key.
[in]alice_public_keyThe public key generated by Alice.
[in]alice_public_key_sizeThe size of alice_public_key in bytes. Must be exactly the size returned by iqr_SIDHGetPublicKeySize().
[out]secretThe shared secret.
[in]secret_sizeThe size of secret in bytes. Must be exactly the size returned by iqr_SIDHGetSecretSize().
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetPublicKeySize()

IQR_API iqr_retval iqr_SIDHGetPublicKeySize ( const iqr_SIDHParams params,
size_t *  public_key_size 
)

Get the size of an SIDH public key, in bytes.

Parameters
[in]paramsThe iqr_SIDHParams to use.
[out]public_key_sizeThe size of a public key, in bytes.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

◆ iqr_SIDHGetSecretSize()

IQR_API iqr_retval iqr_SIDHGetSecretSize ( const iqr_SIDHParams params,
size_t *  secret_size 
)

Get the size of an SIDH secret, in bytes.

Parameters
[in]paramsThe iqr_SIDHParams to use.
[out]secret_sizeThe size of a secret, in bytes.
Returns
IQR_OK on success, or a value from iqr_retval.h when an error occurs.

Variable Documentation

◆ IQR_SIDH_P503

IQR_EXTERN const iqr_SIDHVariant IQR_SIDH_P503

SIDH based on the SIKEp503 scheme parameter set.

◆ IQR_SIDH_P751

IQR_EXTERN const iqr_SIDHVariant IQR_SIDH_P751

SIDH based on the SIKEp751 scheme parameter set.

Detailed Description

ISARA Radiate Security Solution Suite's Supersingular Isogeny Diffie-Hellman (SIDH).

An implementation of SIDH as defined in SIKE.

License
The code and other content set out herein is not in the public domain, is considered a trade secret and is confidential to ISARA Corporation. Use, reproduction or distribution, in whole or in part, of such code or other content is strictly prohibited except by express written permission of ISARA Corporation. Please contact ISARA Corporation at info@.nosp@m.isar.nosp@m.a.com for more information.