Skip to content

Commit 8445493

Browse files
hpke snake_case to camelCase
1 parent 36580b0 commit 8445493

2 files changed

Lines changed: 26 additions & 26 deletions

File tree

wolfcrypt/src/hpke.c

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -150,30 +150,30 @@ int wc_HpkeInit(Hpke* hpke, int kem, int kdf, int aead, void* heap)
150150
#if defined(HAVE_ECC)
151151
#if defined(WOLFSSL_SHA224) || !defined(NO_SHA256)
152152
case DHKEM_P256_HKDF_SHA256:
153-
hpke->curve_id = ECC_SECP256R1;
153+
hpke->curveId = ECC_SECP256R1;
154154
hpke->Nsecret = WC_SHA256_DIGEST_SIZE;
155-
hpke->kem_digest = WC_SHA256;
156-
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curve_id);
155+
hpke->kemDigest = WC_SHA256;
156+
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curveId);
157157
hpke->Npk = 1 + hpke->Ndh * 2;
158158
break;
159159
#endif
160160

161161
#ifdef WOLFSSL_SHA384
162162
case DHKEM_P384_HKDF_SHA384:
163-
hpke->curve_id = ECC_SECP384R1;
163+
hpke->curveId = ECC_SECP384R1;
164164
hpke->Nsecret = WC_SHA384_DIGEST_SIZE;
165-
hpke->kem_digest = WC_SHA384;
166-
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curve_id);
165+
hpke->kemDigest = WC_SHA384;
166+
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curveId);
167167
hpke->Npk = 1 + hpke->Ndh * 2;
168168
break;
169169
#endif
170170

171171
#if defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512)
172172
case DHKEM_P521_HKDF_SHA512:
173-
hpke->curve_id = ECC_SECP521R1;
173+
hpke->curveId = ECC_SECP521R1;
174174
hpke->Nsecret = WC_SHA512_DIGEST_SIZE;
175-
hpke->kem_digest = WC_SHA512;
176-
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curve_id);
175+
hpke->kemDigest = WC_SHA512;
176+
hpke->Ndh = (word32)wc_ecc_get_curve_size_from_id(hpke->curveId);
177177
hpke->Npk = 1 + hpke->Ndh * 2;
178178
break;
179179
#endif
@@ -183,7 +183,7 @@ int wc_HpkeInit(Hpke* hpke, int kem, int kdf, int aead, void* heap)
183183
(defined(WOLFSSL_SHA224) || !defined(NO_SHA256))
184184
case DHKEM_X25519_HKDF_SHA256:
185185
hpke->Nsecret = WC_SHA256_DIGEST_SIZE;
186-
hpke->kem_digest = WC_SHA256;
186+
hpke->kemDigest = WC_SHA256;
187187
hpke->Ndh = CURVE25519_KEYSIZE;
188188
hpke->Npk = CURVE25519_PUB_KEY_SIZE;
189189
break;
@@ -193,7 +193,7 @@ int wc_HpkeInit(Hpke* hpke, int kem, int kdf, int aead, void* heap)
193193
(defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512))
194194
case DHKEM_X448_HKDF_SHA512:
195195
hpke->Nsecret = WC_SHA512_DIGEST_SIZE;
196-
hpke->kem_digest = WC_SHA512;
196+
hpke->kemDigest = WC_SHA512;
197197
/* size of x448 shared secret */
198198
hpke->Ndh = 64;
199199
hpke->Npk = CURVE448_PUB_KEY_SIZE;
@@ -212,21 +212,21 @@ int wc_HpkeInit(Hpke* hpke, int kem, int kdf, int aead, void* heap)
212212
#if defined(WOLFSSL_SHA224) || !defined(NO_SHA256)
213213
case HKDF_SHA256:
214214
hpke->Nh = WC_SHA256_DIGEST_SIZE;
215-
hpke->kdf_digest = WC_SHA256;
215+
hpke->kdfDigest = WC_SHA256;
216216
break;
217217
#endif
218218

219219
#ifdef WOLFSSL_SHA384
220220
case HKDF_SHA384:
221221
hpke->Nh = WC_SHA384_DIGEST_SIZE;
222-
hpke->kdf_digest = WC_SHA384;
222+
hpke->kdfDigest = WC_SHA384;
223223
break;
224224
#endif
225225

226226
#ifdef WOLFSSL_SHA512
227227
case HKDF_SHA512:
228228
hpke->Nh = WC_SHA512_DIGEST_SIZE;
229-
hpke->kdf_digest = WC_SHA512;
229+
hpke->kdfDigest = WC_SHA512;
230230
break;
231231
#endif
232232

@@ -392,7 +392,7 @@ int wc_HpkeDeserializePublicKey(Hpke* hpke, void** key, const byte* in,
392392
if (*key != NULL) {
393393
/* import the x963 key */
394394
ret = wc_ecc_import_x963_ex(in, inSz, (ecc_key*)*key,
395-
hpke->curve_id);
395+
hpke->curveId);
396396
}
397397
break;
398398
#endif
@@ -636,13 +636,13 @@ static int wc_HpkeExtractAndExpand( Hpke* hpke, byte* dh, word32 dh_len,
636636

637637
/* extract */
638638
ret = wc_HpkeLabeledExtract(hpke, hpke->kem_suite_id,
639-
sizeof( hpke->kem_suite_id ), hpke->kem_digest, NULL, 0,
639+
sizeof( hpke->kem_suite_id ), hpke->kemDigest, NULL, 0,
640640
(byte*)EAE_PRK_LABEL_STR, EAE_PRK_LABEL_STR_LEN, dh, dh_len, eae_prk);
641641

642642
/* expand */
643643
if ( ret == 0 ) {
644644
ret = wc_HpkeLabeledExpand(hpke, hpke->kem_suite_id,
645-
sizeof( hpke->kem_suite_id ), hpke->kem_digest, eae_prk,
645+
sizeof( hpke->kem_suite_id ), hpke->kemDigest, eae_prk,
646646
hpke->Nsecret, (byte*)SHARED_SECRET_LABEL_STR,
647647
SHARED_SECRET_LABEL_STR_LEN, kemContext, kem_context_length,
648648
hpke->Nsecret, sharedSecret);
@@ -695,37 +695,37 @@ static int wc_HpkeKeyScheduleBase(Hpke* hpke, HpkeBaseContext* context,
695695

696696
/* extract psk_id, which for base is null */
697697
ret = wc_HpkeLabeledExtract(hpke, hpke->hpke_suite_id,
698-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, NULL, 0,
698+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, NULL, 0,
699699
(byte*)PSK_ID_HASH_LABEL_STR, PSK_ID_HASH_LABEL_STR_LEN, NULL, 0,
700700
key_schedule_context + 1);
701701

702702
/* extract info */
703703
if (ret == 0) {
704704
ret = wc_HpkeLabeledExtract(hpke, hpke->hpke_suite_id,
705-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, NULL, 0,
705+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, NULL, 0,
706706
(byte*)INFO_HASH_LABEL_STR, INFO_HASH_LABEL_STR_LEN, info, infoSz,
707707
key_schedule_context + 1 + hpke->Nh);
708708
}
709709

710710
/* extract secret */
711711
if (ret == 0) {
712712
ret = wc_HpkeLabeledExtract(hpke, hpke->hpke_suite_id,
713-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, sharedSecret,
713+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, sharedSecret,
714714
hpke->Nsecret, (byte*)SECRET_LABEL_STR, SECRET_LABEL_STR_LEN,
715715
NULL, 0, secret);
716716
}
717717

718718
/* expand key */
719719
if (ret == 0)
720720
ret = wc_HpkeLabeledExpand(hpke, hpke->hpke_suite_id,
721-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, secret, hpke->Nh,
721+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, secret, hpke->Nh,
722722
(byte*)KEY_LABEL_STR, KEY_LABEL_STR_LEN, key_schedule_context,
723723
1 + 2 * hpke->Nh, hpke->Nk, context->key);
724724

725725
/* expand nonce */
726726
if (ret == 0) {
727727
ret = wc_HpkeLabeledExpand(hpke, hpke->hpke_suite_id,
728-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, secret, hpke->Nh,
728+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, secret, hpke->Nh,
729729
(byte*)BASE_NONCE_LABEL_STR, BASE_NONCE_LABEL_STR_LEN,
730730
key_schedule_context, 1 + 2 * hpke->Nh, hpke->Nn,
731731
context->base_nonce);
@@ -734,7 +734,7 @@ static int wc_HpkeKeyScheduleBase(Hpke* hpke, HpkeBaseContext* context,
734734
/* expand exporter_secret */
735735
if (ret == 0) {
736736
ret = wc_HpkeLabeledExpand(hpke, hpke->hpke_suite_id,
737-
sizeof( hpke->hpke_suite_id ), hpke->kdf_digest, secret, hpke->Nh,
737+
sizeof( hpke->hpke_suite_id ), hpke->kdfDigest, secret, hpke->Nh,
738738
(byte*)EXP_LABEL_STR, EXP_LABEL_STR_LEN, key_schedule_context,
739739
1 + 2 * hpke->Nh, hpke->Nh, context->exporter_secret);
740740
}

wolfssl/wolfcrypt/hpke.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ typedef struct {
8787
word32 Ndh;
8888
word32 Npk;
8989
word32 Nsecret;
90-
int kdf_digest;
91-
int kem_digest;
92-
int curve_id;
90+
int kdfDigest;
91+
int kemDigest;
92+
int curveId;
9393
word16 kem;
9494
word16 kdf;
9595
word16 aead;

0 commit comments

Comments
 (0)