Skip to content

Commit

Permalink
deploy: 58fa1df
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Sep 4, 2024
1 parent 8878124 commit bff0a55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hpke_rs/dh_kem.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
<span class="kw-2">&amp;</span>[],
alg.private_key_len(),
)<span class="question-mark">?</span>,
KemAlgorithm::DhKemP256 =&gt; {
KemAlgorithm::DhKemP256 | KemAlgorithm::DhKemK256 =&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>ctr = <span class="number">0u8</span>;
<span class="comment">// Do rejection sampling trying to find a valid key.
// It is expected that there aren't too many iteration and that
Expand All @@ -267,14 +267,14 @@
<span class="kw">if </span>ctr == u8::MAX {
<span class="comment">// If we get here we lost. This should never happen.
</span><span class="kw">return </span><span class="prelude-val">Err</span>(Error::CryptoLibraryError(
<span class="string">"Unable to generate a valid P256 private key"</span>.to_string(),
<span class="string">"Unable to generate a valid private key"</span>.to_string(),
));
}
ctr += <span class="number">1</span>;
}
}
<span class="kw">_ </span>=&gt; {
<span class="macro">panic!</span>(<span class="string">"This should be unreachable. Only x25519 and P256 KEMs are implemented"</span>)
<span class="macro">panic!</span>(<span class="string">"This should be unreachable. Only x25519, P256, and K256 KEMs are implemented"</span>)
}
};
<span class="prelude-val">Ok</span>((Crypto::kem_derive_base(alg, <span class="kw-2">&amp;</span>sk)<span class="question-mark">?</span>, sk))
Expand Down
10 changes: 10 additions & 0 deletions src/hpke_rs/kem.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
<a href="#99" id="99">99</a>
<a href="#100" id="100">100</a>
<a href="#101" id="101">101</a>
<a href="#102" id="102">102</a>
<a href="#103" id="103">103</a>
<a href="#104" id="104">104</a>
<a href="#105" id="105">105</a>
<a href="#106" id="106">106</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>alloc::vec::Vec;

<span class="kw">use </span>hpke_rs_crypto::{error::Error, types::KemAlgorithm, HpkeCrypto};
Expand All @@ -121,6 +126,7 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;(Vec&lt;u8&gt;, Vec&lt;u8&gt;), Error&gt; {
<span class="kw">match </span>alg {
KemAlgorithm::DhKemP256
| KemAlgorithm::DhKemK256
| KemAlgorithm::DhKemP384
| KemAlgorithm::DhKemP521
| KemAlgorithm::DhKem25519
Expand All @@ -137,6 +143,7 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;Vec&lt;u8&gt;, Error&gt; {
<span class="kw">match </span>alg {
KemAlgorithm::DhKemP256
| KemAlgorithm::DhKemK256
| KemAlgorithm::DhKemP384
| KemAlgorithm::DhKemP521
| KemAlgorithm::DhKem25519
Expand All @@ -152,6 +159,7 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;(Vec&lt;u8&gt;, Vec&lt;u8&gt;), Error&gt; {
<span class="kw">match </span>alg {
KemAlgorithm::DhKemP256
| KemAlgorithm::DhKemK256
| KemAlgorithm::DhKemP384
| KemAlgorithm::DhKemP521
| KemAlgorithm::DhKem25519
Expand All @@ -169,6 +177,7 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;Vec&lt;u8&gt;, Error&gt; {
<span class="kw">match </span>alg {
KemAlgorithm::DhKemP256
| KemAlgorithm::DhKemK256
| KemAlgorithm::DhKemP384
| KemAlgorithm::DhKemP521
| KemAlgorithm::DhKem25519
Expand All @@ -184,6 +193,7 @@
) -&gt; <span class="prelude-ty">Result</span>&lt;(Vec&lt;u8&gt;, Vec&lt;u8&gt;), Error&gt; {
<span class="kw">match </span>alg {
KemAlgorithm::DhKemP256
| KemAlgorithm::DhKemK256
| KemAlgorithm::DhKemP384
| KemAlgorithm::DhKemP521
| KemAlgorithm::DhKem25519
Expand Down

0 comments on commit bff0a55

Please sign in to comment.