@@ -387,6 +387,21 @@ psa_status_t psa_get_key_information(psa_key_handle_t handle,
387
387
* g INTEGER
388
388
* }
389
389
* ```
390
+ * - For Diffie-Hellman key exchange keys (#PSA_KEY_TYPE_DH_PUBLIC_KEY), the
391
+ * `DomainParameters` format as defined by RFC 3279 §2.3.3.
392
+ * ```
393
+ * DomainParameters ::= SEQUENCE {
394
+ * p INTEGER, -- odd prime, p=jq +1
395
+ * g INTEGER, -- generator, g
396
+ * q INTEGER, -- factor of p-1
397
+ * j INTEGER OPTIONAL, -- subgroup factor
398
+ * validationParms ValidationParms OPTIONAL
399
+ * }
400
+ * ValidationParms ::= SEQUENCE {
401
+ * seed BIT STRING,
402
+ * pgenCounter INTEGER
403
+ * }
404
+ * ```
390
405
*
391
406
* \param handle Handle to the key to set domain parameters for.
392
407
* \param[in] data Buffer containing the key domain parameters. The content
@@ -494,6 +509,10 @@ psa_status_t psa_get_key_domain_parameters(psa_key_handle_t handle,
494
509
* and `PSA_ECC_CURVE_BRAINPOOL_PXXX`).
495
510
* This is the content of the `privateKey` field of the `ECPrivateKey`
496
511
* format defined by RFC 5915.
512
+ * - For Diffie-Hellman key exchange key pairs (#PSA_KEY_TYPE_DH_KEYPAIR), the
513
+ * format is the representation of the private key `x` as a big-endian byte
514
+ * string. The length of the byte string is the private key size in bytes
515
+ * (leading zeroes are not stripped).
497
516
* - For public keys (key types for which #PSA_KEY_TYPE_IS_PUBLIC_KEY is
498
517
* true), the format is the same as for psa_export_public_key().
499
518
*
@@ -565,6 +584,10 @@ psa_status_t psa_export_key(psa_key_handle_t handle,
565
584
* representation of the public key `y = g^x mod p` as a big-endian byte
566
585
* string. The length of the byte string is the length of the base prime `p`
567
586
* in bytes.
587
+ * - For Diffie-Hellman key exchange public keys (#PSA_KEY_TYPE_DH_PUBLIC_KEY),
588
+ * the format is the representation of the public key `y = g^x mod p` as a
589
+ * big-endian byte string. The length of the byte string is the length of the
590
+ * base prime `p` in bytes.
568
591
*
569
592
* \param handle Handle to the key to export.
570
593
* \param[out] data Buffer where the key data is to be written.
@@ -2302,6 +2325,12 @@ typedef struct {
2302
2325
* parameters. The key domain parameters can also be
2303
2326
* provided by psa_set_key_domain_parameters(),
2304
2327
* which documents the format of the structure.
2328
+ * - For a DH key (\p type is
2329
+ * #PSA_KEY_TYPE_DH_KEYPAIR), the \p extra is an
2330
+ * optional structure specifying the key domain
2331
+ * parameters. The key domain parameters can also be
2332
+ * provided by psa_set_key_domain_parameters(),
2333
+ * which documents the format of the structure.
2305
2334
* \param extra_size Size of the buffer that \p extra
2306
2335
* points to, in bytes. Note that if \p extra is
2307
2336
* \c NULL then \p extra_size must be zero.
0 commit comments