Skip to content

Commit

Permalink
Persistent private keys for agreement (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Jan 18, 2024
1 parent 1a1fa0d commit 3448b87
Show file tree
Hide file tree
Showing 13 changed files with 1,154 additions and 530 deletions.
721 changes: 419 additions & 302 deletions aws-lc-rs/src/agreement.rs

Large diffs are not rendered by default.

File renamed without changes.
462 changes: 462 additions & 0 deletions aws-lc-rs/src/agreement/ephemeral.rs

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion aws-lc-rs/src/bn.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR ISC

use crate::ptr::{ConstPointer, DetachableLcPtr};
use crate::ptr::{ConstPointer, DetachableLcPtr, LcPtr};
use aws_lc::{BN_bin2bn, BN_bn2bin, BN_cmp, BN_new, BN_num_bits, BN_num_bytes, BN_set_u64, BIGNUM};
use mirai_annotations::unrecoverable;
use std::cmp::Ordering;
use std::ptr::null_mut;

impl TryFrom<&[u8]> for LcPtr<BIGNUM> {
type Error = ();

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error> {
unsafe { LcPtr::new(BN_bin2bn(bytes.as_ptr(), bytes.len(), null_mut())) }
}
}

impl TryFrom<&[u8]> for DetachableLcPtr<BIGNUM> {
type Error = ();

Expand Down
Loading

0 comments on commit 3448b87

Please sign in to comment.