gnutls_hpke_mode_t: New enum
gnutls_hpke_role_t: New enum
gnutls_hpke_context_st: New context structure
-gnutls_hpke_context_init: New function
-gnutls_hpke_context_deinit: New function
-gnutls_hpke_context_set_psk: New function
-gnutls_hpke_context_set_sender_privkey: New function
-gnutls_hpke_context_set_sender_pubkey: New function
-gnutls_hpke_context_get_enc_size: New function
+gnutls_hpke_init: New function
+gnutls_hpke_deinit: New function
+gnutls_hpke_set_psk: New function
+gnutls_hpke_set_sender_privkey: New function
+gnutls_hpke_set_sender_pubkey: New function
+gnutls_hpke_get_enc_size: New function
gnutls_hpke_encap: New function
gnutls_hpke_seal: New function
gnutls_hpke_decap: New function
gnutls_hpke_open: New function
-gnutls_hpke_context_set_ikme: New function
+gnutls_hpke_set_ikme: New function
gnutls_hpke_generate_keypair: New function
gnutls_hpke_get_seq: New function
gnutls_hpke_set_seq: New function
name = gnutls_hpke_decap
[suppress_function]
-name = gnutls_hpke_context_init
+name = gnutls_hpke_init
[suppress_function]
-name = gnutls_hpke_context_deinit
+name = gnutls_hpke_deinit
[suppress_function]
-name = gnutls_hpke_context_set_psk
+name = gnutls_hpke_set_psk
[suppress_function]
-name = gnutls_hpke_context_set_sender_privkey
+name = gnutls_hpke_set_sender_privkey
[suppress_function]
-name = gnutls_hpke_context_set_sender_pubkey
+name = gnutls_hpke_set_sender_pubkey
[suppress_function]
-name = gnutls_hpke_context_get_enc_size
+name = gnutls_hpke_get_enc_size
[suppress_function]
name = gnutls_hpke_seal
name = gnutls_hpke_open
[suppress_function]
-name = gnutls_hpke_context_set_ikme
+name = gnutls_hpke_set_ikme
[suppress_function]
name = gnutls_hpke_generate_keypair
gnutls_hmac_init@GNUTLS_3_4
gnutls_hmac_output@GNUTLS_3_4
gnutls_hmac_set_nonce@GNUTLS_3_4
-gnutls_hpke_context_deinit@GNUTLS_3_8_13
-gnutls_hpke_context_get_enc_size@GNUTLS_3_8_13
-gnutls_hpke_context_init@GNUTLS_3_8_13
-gnutls_hpke_context_set_ikme@GNUTLS_3_8_13
-gnutls_hpke_context_set_psk@GNUTLS_3_8_13
-gnutls_hpke_context_set_sender_privkey@GNUTLS_3_8_13
-gnutls_hpke_context_set_sender_pubkey@GNUTLS_3_8_13
+gnutls_hpke_deinit@GNUTLS_3_8_13
+gnutls_hpke_get_enc_size@GNUTLS_3_8_13
+gnutls_hpke_init@GNUTLS_3_8_13
+gnutls_hpke_set_ikme@GNUTLS_3_8_13
+gnutls_hpke_set_psk@GNUTLS_3_8_13
+gnutls_hpke_set_sender_privkey@GNUTLS_3_8_13
+gnutls_hpke_set_sender_pubkey@GNUTLS_3_8_13
gnutls_hpke_decap@GNUTLS_3_8_13
gnutls_hpke_encap@GNUTLS_3_8_13
gnutls_hpke_export@GNUTLS_3_8_13
FUNCS += functions/gnutls_hmac_output.short
FUNCS += functions/gnutls_hmac_set_nonce
FUNCS += functions/gnutls_hmac_set_nonce.short
-FUNCS += functions/gnutls_hpke_context_deinit
-FUNCS += functions/gnutls_hpke_context_deinit.short
-FUNCS += functions/gnutls_hpke_context_get_enc_size
-FUNCS += functions/gnutls_hpke_context_get_enc_size.short
-FUNCS += functions/gnutls_hpke_context_init
-FUNCS += functions/gnutls_hpke_context_init.short
-FUNCS += functions/gnutls_hpke_context_set_ikme
-FUNCS += functions/gnutls_hpke_context_set_ikme.short
-FUNCS += functions/gnutls_hpke_context_set_psk
-FUNCS += functions/gnutls_hpke_context_set_psk.short
-FUNCS += functions/gnutls_hpke_context_set_sender_privkey
-FUNCS += functions/gnutls_hpke_context_set_sender_privkey.short
-FUNCS += functions/gnutls_hpke_context_set_sender_pubkey
-FUNCS += functions/gnutls_hpke_context_set_sender_pubkey.short
+FUNCS += functions/gnutls_hpke_deinit
+FUNCS += functions/gnutls_hpke_deinit.short
+FUNCS += functions/gnutls_hpke_get_enc_size
+FUNCS += functions/gnutls_hpke_get_enc_size.short
+FUNCS += functions/gnutls_hpke_init
+FUNCS += functions/gnutls_hpke_init.short
+FUNCS += functions/gnutls_hpke_set_ikme
+FUNCS += functions/gnutls_hpke_set_ikme.short
+FUNCS += functions/gnutls_hpke_set_psk
+FUNCS += functions/gnutls_hpke_set_psk.short
+FUNCS += functions/gnutls_hpke_set_sender_privkey
+FUNCS += functions/gnutls_hpke_set_sender_privkey.short
+FUNCS += functions/gnutls_hpke_set_sender_pubkey
+FUNCS += functions/gnutls_hpke_set_sender_pubkey.short
FUNCS += functions/gnutls_hpke_decap
FUNCS += functions/gnutls_hpke_decap.short
FUNCS += functions/gnutls_hpke_encap
APIMANS += gnutls_hmac_init.3
APIMANS += gnutls_hmac_output.3
APIMANS += gnutls_hmac_set_nonce.3
-APIMANS += gnutls_hpke_context_deinit.3
-APIMANS += gnutls_hpke_context_get_enc_size.3
-APIMANS += gnutls_hpke_context_init.3
-APIMANS += gnutls_hpke_context_set_ikme.3
-APIMANS += gnutls_hpke_context_set_psk.3
-APIMANS += gnutls_hpke_context_set_sender_privkey.3
-APIMANS += gnutls_hpke_context_set_sender_pubkey.3
+APIMANS += gnutls_hpke_deinit.3
+APIMANS += gnutls_hpke_get_enc_size.3
+APIMANS += gnutls_hpke_init.3
+APIMANS += gnutls_hpke_set_ikme.3
+APIMANS += gnutls_hpke_set_psk.3
+APIMANS += gnutls_hpke_set_sender_privkey.3
+APIMANS += gnutls_hpke_set_sender_pubkey.3
APIMANS += gnutls_hpke_decap.3
APIMANS += gnutls_hpke_encap.3
APIMANS += gnutls_hpke_export.3
}
/**
- * gnutls_hpke_context_init:
+ * gnutls_hpke_init:
* @ctx: A pointer to the HPKE context to initialize.
* @mode: The HPKE mode to use (Base, PSK, Auth, or AuthPSK).
* @role: The role of the context (Sender or Receiver).
* @aead: The AEAD algorithm to use (e.g., AES-128-GCM).
* This function initializes the HPKE context with the specified parameters.
* It allocates memory for the context and sets the initial values for the fields based on the provided parameters.
- * The context must be deinitialized using gnutls_hpke_context_deinit() when it
+ * The context must be deinitialized using gnutls_hpke_deinit() when it
* is no longer needed to free any allocated resources and securely erase sensitive information.
* Returns: 0 on success, or a negative error code on failure
*/
-int gnutls_hpke_context_init(gnutls_hpke_context_t *ctx,
- const gnutls_hpke_mode_t mode,
- const gnutls_hpke_role_t role,
- const gnutls_hpke_kem_t kem,
- const gnutls_hpke_kdf_t kdf,
- const gnutls_hpke_aead_t aead)
+int gnutls_hpke_init(gnutls_hpke_context_t *ctx, const gnutls_hpke_mode_t mode,
+ const gnutls_hpke_role_t role, const gnutls_hpke_kem_t kem,
+ const gnutls_hpke_kdf_t kdf, const gnutls_hpke_aead_t aead)
{
if (ctx == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
}
/**
- * gnutls_hpke_context_deinit:
+ * gnutls_hpke_deinit:
* @ctx: The HPKE context to deinitialize.
*
* This function deinitializes the HPKE context and securely erases any
* to prevent sensitive data from lingering in memory.
* Returns: 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_context_deinit(gnutls_hpke_context_t ctx)
+int gnutls_hpke_deinit(gnutls_hpke_context_t ctx)
{
if (ctx == NULL) {
return 0;
}
/**
- * gnutls_hpke_context_set_psk:
+ * gnutls_hpke_set_psk:
* @ctx: The HPKE context to set the PSK for.
* @psk: A pointer to a gnutls_datum_t structure containing the PSK value and its size.
* @psk_id: A pointer to a gnutls_datum_t structure containing the PSK identifier and its size.
*
- * This function sets the PSK and its identifier in the HPKE context.
+ * This function sets the PSK and its identifier in the HPKE context.
* It securely erases any existing PSK and PSK identifier in the context before setting the new values.
* The function checks that the provided PSK and PSK identifier are valid and that the context is in
* a mode that supports PSKs.
*
* It returns 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_context_set_psk(gnutls_hpke_context_t ctx,
- const gnutls_datum_t *psk,
- const gnutls_datum_t *psk_id)
+int gnutls_hpke_set_psk(gnutls_hpke_context_t ctx, const gnutls_datum_t *psk,
+ const gnutls_datum_t *psk_id)
{
if (ctx == NULL || psk == NULL || psk_id == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
}
/**
- * gnutls_hpke_context_set_sender_privkey:
+ * gnutls_hpke_set_sender_privkey:
* @ctx: The HPKE context to set the sender's private key for.
* @sender_privkey: The sender's private key to set in the context.
*
*
* It returns 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_context_set_sender_privkey(gnutls_hpke_context_t ctx,
- gnutls_privkey_t sender_privkey)
+int gnutls_hpke_set_sender_privkey(gnutls_hpke_context_t ctx,
+ gnutls_privkey_t sender_privkey)
{
if (ctx == NULL || sender_privkey == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
}
/**
- * gnutls_hpke_context_set_sender_pubkey:
+ * gnutls_hpke_set_sender_pubkey:
* @ctx: The HPKE context to set the sender's public key for.
* @sender_pubkey: The sender's public key to set in the context.
*
*
* It returns 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_context_set_sender_pubkey(gnutls_hpke_context_t ctx,
- gnutls_pubkey_t sender_pubkey)
+int gnutls_hpke_set_sender_pubkey(gnutls_hpke_context_t ctx,
+ gnutls_pubkey_t sender_pubkey)
{
if (ctx == NULL || sender_pubkey == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
}
/**
- * gnutls_hpke_context_get_enc_size:
+ * gnutls_hpke_get_enc_size:
* @ctx: The HPKE context to get the encapsulated key size for.
*
* This function returns the size of the encapsulated key (enc) that will be generated by gnutls_hpke_encap() for the
* It returns the size of the encapsulated key in bytes, or 0 if the context is NULL or if there is an error determining
* the size.
*/
-size_t gnutls_hpke_context_get_enc_size(const gnutls_hpke_context_t ctx)
+size_t gnutls_hpke_get_enc_size(const gnutls_hpke_context_t ctx)
{
if (ctx == NULL) {
return 0;
}
/**
- * gnutls_hpke_context_set_ikme:
+ * gnutls_hpke_set_ikme:
* @ctx: The HPKE context to set the IKME for.
* @ikme: A pointer to a gnutls_datum_t structure containing the IKME value and its size.
*
*
* It returns 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_context_set_ikme(gnutls_hpke_context_t ctx,
- const gnutls_datum_t *ikme)
+int gnutls_hpke_set_ikme(gnutls_hpke_context_t ctx, const gnutls_datum_t *ikme)
{
if (ctx == NULL || ikme == NULL || ikme->data == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
* gnutls_hpke_export:
* @ctx: The HPKE context to use for exporting the secret.
* @exporter_context: A pointer to a gnutls_datum_t structure containing the application-specific context to be included
- * in the export.
+ * in the export.
* @L: The length in bytes of the secret to be exported. This should be a positive integer that does not exceed the
* maximum allowed size for HPKE exports.
* @secret: A pointer to a gnutls_datum_t structure where the exported secret will be stored. The function will allocate
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
-
* along with this program. If not, see <https://www.gnu.org/licenses/>
-
*
*/
typedef struct gnutls_hpke_context_st *gnutls_hpke_context_t;
-int gnutls_hpke_context_init(gnutls_hpke_context_t *ctx,
- const gnutls_hpke_mode_t mode,
- const gnutls_hpke_role_t role,
- const gnutls_hpke_kem_t kem,
- const gnutls_hpke_kdf_t kdf,
- const gnutls_hpke_aead_t aead);
+int gnutls_hpke_init(gnutls_hpke_context_t *ctx, const gnutls_hpke_mode_t mode,
+ const gnutls_hpke_role_t role, const gnutls_hpke_kem_t kem,
+ const gnutls_hpke_kdf_t kdf,
+ const gnutls_hpke_aead_t aead);
-int gnutls_hpke_context_deinit(gnutls_hpke_context_t ctx);
+int gnutls_hpke_deinit(gnutls_hpke_context_t ctx);
-int gnutls_hpke_context_set_psk(gnutls_hpke_context_t ctx,
- const gnutls_datum_t *psk,
- const gnutls_datum_t *psk_id);
+int gnutls_hpke_set_psk(gnutls_hpke_context_t ctx, const gnutls_datum_t *psk,
+ const gnutls_datum_t *psk_id);
-int gnutls_hpke_context_set_sender_privkey(gnutls_hpke_context_t ctx,
- gnutls_privkey_t sender_privkey);
+int gnutls_hpke_set_sender_privkey(gnutls_hpke_context_t ctx,
+ gnutls_privkey_t sender_privkey);
-int gnutls_hpke_context_set_sender_pubkey(gnutls_hpke_context_t ctx,
- gnutls_pubkey_t sender_pubkey);
+int gnutls_hpke_set_sender_pubkey(gnutls_hpke_context_t ctx,
+ gnutls_pubkey_t sender_pubkey);
-size_t gnutls_hpke_context_get_enc_size(const gnutls_hpke_context_t ctx);
+size_t gnutls_hpke_get_enc_size(const gnutls_hpke_context_t ctx);
int gnutls_hpke_encap(gnutls_hpke_context_t ctx, const gnutls_datum_t *info,
gnutls_datum_t *enc, gnutls_pubkey_t receiver_pubkey);
const gnutls_datum_t *ciphertext,
gnutls_datum_t *plaintext);
-int gnutls_hpke_context_set_ikme(gnutls_hpke_context_t ctx,
- const gnutls_datum_t *ikme);
+int gnutls_hpke_set_ikme(gnutls_hpke_context_t ctx, const gnutls_datum_t *ikme);
int gnutls_hpke_generate_keypair(const gnutls_hpke_kem_t kem,
const gnutls_datum_t *ikm,
}
#endif
-#endif // GNUTLS_HPKE_H
+#endif /* GNUTLS_HPKE_H */
gnutls_pkcs11_obj_get_pk_algorithm;
gnutls_hpke_encap;
gnutls_hpke_decap;
- gnutls_hpke_context_init;
- gnutls_hpke_context_deinit;
- gnutls_hpke_context_set_psk;
- gnutls_hpke_context_set_sender_privkey;
- gnutls_hpke_context_set_sender_pubkey;
- gnutls_hpke_context_get_enc_size;
+ gnutls_hpke_init;
+ gnutls_hpke_deinit;
+ gnutls_hpke_set_psk;
+ gnutls_hpke_set_sender_privkey;
+ gnutls_hpke_set_sender_pubkey;
+ gnutls_hpke_get_enc_size;
gnutls_hpke_seal;
gnutls_hpke_open;
- gnutls_hpke_context_set_ikme;
+ gnutls_hpke_set_ikme;
gnutls_hpke_generate_keypair;
gnutls_hpke_get_seq;
gnutls_hpke_set_seq;
gnutls_datum_t ciphertext_out = { NULL, 0 };
gnutls_datum_t exporter_out = { NULL, 0 };
- ret = gnutls_hpke_context_init(&sender_ctx, params->mode,
- GNUTLS_HPKE_ROLE_SENDER, params->kem,
- params->kdf, params->aead);
+ ret = gnutls_hpke_init(&sender_ctx, params->mode,
+ GNUTLS_HPKE_ROLE_SENDER, params->kem,
+ params->kdf, params->aead);
if (ret < 0) {
- fail("gnutls_hpke_context_init (mode: %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_init (mode: %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf, params->aead,
gnutls_strerror(ret));
goto cleanup;
}
- ret = gnutls_hpke_context_set_ikme(sender_ctx, ¶ms->ikmE);
+ ret = gnutls_hpke_set_ikme(sender_ctx, ¶ms->ikmE);
if (ret < 0) {
- fail("gnutls_hpke_context_set_ikme (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_set_ikme (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf, params->aead,
gnutls_strerror(ret));
goto cleanup;
}
if (params->psk != NULL && params->psk_id != NULL) {
- ret = gnutls_hpke_context_set_psk(sender_ctx, params->psk,
- params->psk_id);
+ ret = gnutls_hpke_set_psk(sender_ctx, params->psk,
+ params->psk_id);
if (ret < 0) {
- fail("gnutls_hpke_context_set_psk (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_set_psk (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf,
params->aead, gnutls_strerror(ret));
goto cleanup;
goto cleanup;
}
- ret = gnutls_hpke_context_set_sender_privkey(sender_ctx, skS);
+ ret = gnutls_hpke_set_sender_privkey(sender_ctx, skS);
if (ret < 0) {
- fail("gnutls_hpke_context_set_sender_privkey (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_set_sender_privkey (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf,
params->aead, gnutls_strerror(ret));
goto cleanup;
goto cleanup;
}
- ret = gnutls_hpke_context_init(&receiver_ctx, params->mode,
- GNUTLS_HPKE_ROLE_RECEIVER, params->kem,
- params->kdf, params->aead);
+ ret = gnutls_hpke_init(&receiver_ctx, params->mode,
+ GNUTLS_HPKE_ROLE_RECEIVER, params->kem,
+ params->kdf, params->aead);
if (ret < 0) {
fail("gnutls_context_init (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf, params->aead,
}
if (params->psk != NULL && params->psk_id != NULL) {
- ret = gnutls_hpke_context_set_psk(receiver_ctx, params->psk,
- params->psk_id);
+ ret = gnutls_hpke_set_psk(receiver_ctx, params->psk,
+ params->psk_id);
if (ret < 0) {
- fail("gnutls_hpke_context_set_psk (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_set_psk (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf,
params->aead, gnutls_strerror(ret));
goto cleanup;
}
if (params->ikmS != NULL) {
- ret = gnutls_hpke_context_set_sender_pubkey(receiver_ctx, pkS);
+ ret = gnutls_hpke_set_sender_pubkey(receiver_ctx, pkS);
if (ret < 0) {
- fail("gnutls_hpke_context_set_sender_pubkey (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("gnutls_hpke_set_sender_pubkey (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf,
params->aead, gnutls_strerror(ret));
goto cleanup;
gnutls_pubkey_deinit(pkR);
gnutls_privkey_deinit(skS);
gnutls_pubkey_deinit(pkS);
- gnutls_hpke_context_deinit(sender_ctx);
- gnutls_hpke_context_deinit(receiver_ctx);
+ gnutls_hpke_deinit(sender_ctx);
+ gnutls_hpke_deinit(receiver_ctx);
if (enc.data != NULL) {
gnutls_free(enc.data);