Skip to content

Commit ccd7ef6

Browse files
Copilotachamayou
andauthored
Rename HashProvider::Hash to HashProvider::hash (#7660)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
1 parent b63d230 commit ccd7ef6

13 files changed

Lines changed: 17 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- `GET` and `HEAD` `/node/ledger-chunk?since={seqno}` and `/node/ledger-chunk/{chunk_name}` endpoints, gated by the `LedgerChunkDownload` RPC interface operator feature. See [documentation](https://microsoft.github.io/CCF/main/operations/ledger_snapshot.html#download-endpoints) for more detail.
1515
- `GET` and `HEAD` `/node/ledger-chunk/{chunk_name}` and `/node/snapshot/{snapshot_name}` now support the `Want-Repr-Digest` request header and return the `Repr-Digest` response header accordingly (RFC 9530). Supported algorithms are `sha-256`, `sha-384`, and `sha-512`. If no supported algorithm is requested, the server defaults to `sha-256` (#7650).
1616

17+
### Changed
18+
19+
- `ccf::crypto::HashProvider::Hash()` has been renamed to `ccf::crypto::HashProvider::hash()` for consistency with the rest of the API (#7660).
20+
1721
### Fixed
1822

1923
- Only rollback uncommittable indices during become_leader (#7620)

include/ccf/crypto/hash_provider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace ccf::crypto
2121
* @param size The size of @p data
2222
* @param type The type of hash to compute
2323
*/
24-
virtual HashBytes Hash(
24+
virtual HashBytes hash(
2525
const uint8_t* data, size_t size, MDType type) const = 0;
2626

2727
virtual ~HashProvider() = default;

js/ccf-app/src/consensus.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ export const getViewForSeqno = ccf.consensus.getViewForSeqno.bind(
3131
ccf.consensus,
3232
);
3333

34-
export { TransactionStatus } from "./global";
34+
export type { TransactionStatus } from "./global";

js/ccf-app/src/crypto.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const pubEddsaJwkToPem = ccf.crypto.pubEddsaJwkToPem;
132132
*/
133133
export const eddsaJwkToPem = ccf.crypto.eddsaJwkToPem;
134134

135-
export {
135+
export type {
136136
WrapAlgoParams,
137137
AesKwpParams,
138138
RsaOaepParams,

js/ccf-app/src/historical.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ export const dropCachedStates = ccf.historical.dropCachedStates.bind(
4848
ccf.historical,
4949
);
5050

51-
export { HistoricalState, Receipt, Proof, ProofElement } from "./global";
51+
export type { HistoricalState, Receipt, Proof, ProofElement } from "./global";

js/ccf-app/src/kv.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,4 @@ export function typedKvSet<K, V>(
182182
*/
183183
export const rawKv = ccf.kv;
184184

185-
export { KvMap, KvSet, KvMaps } from "./global";
185+
export type { KvMap, KvSet, KvMaps } from "./global";

src/crypto/openssl/ec_key_pair.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace ccf::crypto
164164
md_type = get_md_for_ec(get_curve_id());
165165
}
166166
OpenSSLHashProvider hp;
167-
HashBytes hash = hp.Hash(d.data(), d.size(), md_type);
167+
HashBytes hash = hp.hash(d.data(), d.size(), md_type);
168168
return sign_hash(hash.data(), hash.size());
169169
}
170170

@@ -179,7 +179,7 @@ namespace ccf::crypto
179179
md_type = get_md_for_ec(get_curve_id());
180180
}
181181
OpenSSLHashProvider hp;
182-
HashBytes hash = hp.Hash(d.data(), d.size(), md_type);
182+
HashBytes hash = hp.hash(d.data(), d.size(), md_type);
183183
return sign_hash(hash.data(), hash.size(), sig_size, sig);
184184
}
185185

src/crypto/openssl/ec_public_key.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ namespace ccf::crypto
184184
md_type = get_md_for_ec(get_curve_id());
185185
}
186186
OpenSSLHashProvider hp;
187-
bytes = hp.Hash(contents, contents_size, md_type);
187+
bytes = hp.hash(contents, contents_size, md_type);
188188
return verify_hash(bytes.data(), bytes.size(), sig, sig_size, md_type);
189189
}
190190

src/crypto/openssl/hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace ccf::crypto
5353
* @param size The size of @p data
5454
* @param type The type of hash to compute
5555
*/
56-
HashBytes Hash(const uint8_t* data, size_t size, MDType type) const override
56+
HashBytes hash(const uint8_t* data, size_t size, MDType type) const override
5757
{
5858
const auto* o_md_type = OpenSSL::get_md_type(type);
5959
HashBytes r(EVP_MD_size(o_md_type));

src/crypto/openssl/rsa_key_pair.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ namespace ccf::crypto
219219
constexpr size_t MAX_SIG_SIZE = 2048;
220220

221221
std::vector<uint8_t> r(MAX_SIG_SIZE);
222-
auto hash = OpenSSLHashProvider().Hash(d.data(), d.size(), md_type);
222+
auto hash = OpenSSLHashProvider().hash(d.data(), d.size(), md_type);
223223
Unique_EVP_PKEY_CTX pctx(key);
224224
CHECK1(EVP_PKEY_sign_init(pctx));
225225
CHECK1(EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING));

0 commit comments

Comments
 (0)