gnutls_hpke_seal: New function
gnutls_hpke_decap: New function
gnutls_hpke_open: 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
gnutls_hpke_export: New function
* Version 3.8.12 (released 2026-02-09)
gnutls_hpke_export@GNUTLS_3_8_13
gnutls_hpke_generate_keypair@GNUTLS_3_8_13
gnutls_hpke_get_enc_size@GNUTLS_3_8_13
-gnutls_hpke_get_seq@GNUTLS_3_8_13
gnutls_hpke_init@GNUTLS_3_8_13
gnutls_hpke_open@GNUTLS_3_8_13
gnutls_hpke_seal@GNUTLS_3_8_13
-gnutls_hpke_set_ikme@GNUTLS_3_8_13
-gnutls_hpke_set_seq@GNUTLS_3_8_13
gnutls_idna_map@GNUTLS_3_4
gnutls_idna_reverse_map@GNUTLS_3_4
gnutls_init@GNUTLS_3_4
FUNCS += functions/gnutls_hpke_generate_keypair.short
FUNCS += functions/gnutls_hpke_get_enc_size
FUNCS += functions/gnutls_hpke_get_enc_size.short
-FUNCS += functions/gnutls_hpke_get_seq
-FUNCS += functions/gnutls_hpke_get_seq.short
FUNCS += functions/gnutls_hpke_init
FUNCS += functions/gnutls_hpke_init.short
FUNCS += functions/gnutls_hpke_open
FUNCS += functions/gnutls_hpke_open.short
FUNCS += functions/gnutls_hpke_seal
FUNCS += functions/gnutls_hpke_seal.short
-FUNCS += functions/gnutls_hpke_set_ikme
-FUNCS += functions/gnutls_hpke_set_ikme.short
-FUNCS += functions/gnutls_hpke_set_seq
-FUNCS += functions/gnutls_hpke_set_seq.short
FUNCS += functions/gnutls_idna_map
FUNCS += functions/gnutls_idna_map.short
FUNCS += functions/gnutls_idna_reverse_map
APIMANS += gnutls_hpke_export.3
APIMANS += gnutls_hpke_generate_keypair.3
APIMANS += gnutls_hpke_get_enc_size.3
-APIMANS += gnutls_hpke_get_seq.3
APIMANS += gnutls_hpke_init.3
APIMANS += gnutls_hpke_open.3
APIMANS += gnutls_hpke_seal.3
-APIMANS += gnutls_hpke_set_ikme.3
-APIMANS += gnutls_hpke_set_seq.3
APIMANS += gnutls_idna_map.3
APIMANS += gnutls_idna_reverse_map.3
APIMANS += gnutls_init.3
uint64_t seq;
};
+/* For testing purposes */
+extern int _gnutls_hpke_get_seq(gnutls_hpke_context_t ctx, uint64_t *seq);
+extern int _gnutls_hpke_set_ikme(gnutls_hpke_context_t ctx,
+ const gnutls_datum_t *ikme);
+
static bool is_auth_mode(gnutls_hpke_mode_t mode)
{
return mode == GNUTLS_HPKE_MODE_AUTH ||
}
/**
- * gnutls_hpke_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_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_get_seq:
+ * _gnutls_hpke_get_seq:
* @ctx: The HPKE context to get the sequence number from.
* @seq: A pointer to a uint64_t variable where the current sequence number will be stored.
*
*
* It returns 0 on success, or a negative error code on failure.
*/
-int gnutls_hpke_get_seq(gnutls_hpke_context_t ctx, uint64_t *seq)
+int _gnutls_hpke_get_seq(gnutls_hpke_context_t ctx, uint64_t *seq)
{
if (ctx == NULL || seq == NULL) {
return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
return 0;
}
-/**
- * gnutls_hpke_set_seq:
- * @ctx: The HPKE context to set the sequence number for.
- * @seq: The sequence number to set in the context.
- *
- * This function sets the sequence number in the HPKE context. The sequence number is used to derive unique nonces for
- * encryption and decryption operations in HPKE. The function checks that the provided parameters are valid and that the
- * context is properly initialized and that the role of the context is Receiver, as only the receiver should be setting
- * the sequence number (the sender's sequence number is managed internally by gnutls_hpke_seal()).
- *
- * It returns 0 on success, or a negative error code on failure.
- */
-int gnutls_hpke_set_seq(gnutls_hpke_context_t ctx, uint64_t seq)
-{
- if (ctx == NULL) {
- return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
- }
-
- if (ctx->role == GNUTLS_HPKE_ROLE_SENDER) {
- return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
- }
-
- ctx->seq = seq;
- return 0;
-}
-
/**
* gnutls_hpke_export:
* @ctx: The HPKE context to use for exporting the secret.
const gnutls_datum_t *ciphertext,
gnutls_datum_t *plaintext);
-int gnutls_hpke_set_ikme(gnutls_hpke_context_t ctx, const gnutls_datum_t *ikme);
-
int gnutls_hpke_generate_keypair(gnutls_hpke_kem_t kem,
const gnutls_datum_t *ikm,
gnutls_privkey_t privkey,
gnutls_pubkey_t pubkey);
-int gnutls_hpke_get_seq(gnutls_hpke_context_t ctx, uint64_t *seq);
-int gnutls_hpke_set_seq(gnutls_hpke_context_t ctx, uint64_t seq);
-
int gnutls_hpke_export(gnutls_hpke_context_t ctx,
const gnutls_datum_t *exporter_context, const size_t L,
gnutls_datum_t *secret);
gnutls_hpke_get_enc_size;
gnutls_hpke_seal;
gnutls_hpke_open;
- gnutls_hpke_set_ikme;
gnutls_hpke_generate_keypair;
- gnutls_hpke_get_seq;
- gnutls_hpke_set_seq;
gnutls_hpke_export;
local:
*;
_gnutls_pathbuf_deinit;
# needed by tests/pkcs11/eddsa-ecpoint-encodings
_gnutls_pubkey_import_ecc_eddsa;
+ # needed by tests/hpke-tests
+ _gnutls_hpke_get_seq;
+ _gnutls_hpke_set_ikme;
} GNUTLS_3_4;
#include <stdbool.h>
#include <stdint.h>
+extern int _gnutls_hpke_get_seq(gnutls_hpke_context_t ctx, uint64_t *seq);
+extern int _gnutls_hpke_set_ikme(gnutls_hpke_context_t ctx,
+ const gnutls_datum_t *ikme);
+
static unsigned char info[] = { 0x4f, 0x64, 0x65, 0x20, 0x6f, 0x6e, 0x20,
0x61, 0x20, 0x47, 0x72, 0x65, 0x63, 0x69,
0x61, 0x6e, 0x20, 0x55, 0x72, 0x6e };
gnutls_strerror(ret));
}
- ret = gnutls_hpke_set_ikme(sender_ctx, ¶ms->ikmE);
+ ret = _gnutls_hpke_set_ikme(sender_ctx, ¶ms->ikmE);
if (ret < 0) {
- fail("gnutls_hpke_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));
}
}
uint64_t seq;
- ret = gnutls_hpke_get_seq(receiver_ctx, &seq);
+ ret = _gnutls_hpke_get_seq(receiver_ctx, &seq);
if (ret < 0) {
- fail("gnutls_hpke_get_seq (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
+ fail("_gnutls_hpke_get_seq (mode %d, kem: %d, kdf: %d, aead: %d) failed: %s\n",
params->mode, params->kem, params->kdf,
params->aead, gnutls_strerror(ret));
}