Poll-based encrypt/decrypt/sign API support in asynchronous and synchronous call

Đang mở
#1,976 9 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
cryptography

Hướng nghiên cứu

Bắt đầu với trait crypto/cipher/MessageDecrypter được hiển thị trong issue và xem lại tài liệu API crypto liên quan của rustls. Truy vết mọi call site của encrypt/decrypt để xác định poll contract cho các caller đồng bộ và bất đồng bộ, sau đó xác minh rằng cả hai chế độ sử dụng đều được bao phủ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Checklist

Describe the solution you'd like
https://docs.rs/rustls/latest/rustls/crypto/cipher/trait.MessageDecrypter.html

convert crypto api to poll based

from

pub trait MessageDecrypter: Send + Sync {
    /// Decrypt the given TLS message `msg`, using the sequence number
    /// `seq` which can be used to derive a unique [`Nonce`].
    fn decrypt<'a>(
        &mut self,
        msg: InboundOpaqueMessage<'a>,
        seq: u64,
    ) -> Result<InboundPlainMessage<'a>, Error>;
}

to

pub trait MessageDecrypter: Send + Sync {
    /// Decrypt the given TLS message `msg`, using the sequence number
    /// `seq` which can be used to derive a unique [`Nonce`].
    fn decrypt<'a>(
        &mut self,
        cx: &mut Context<'a>,
        msg: InboundOpaqueMessage<'a>,
        seq: u64,
    ) -> Result<InboundPlainMessage<'a>, Error>;
}

so that we can call tokio#poll_read to make encrypt/decrypt async

every encrypt/decrypt should call through trait, so we can hack it

Additional context
rustls only support poll method. user decide whether sync or async. If sync, just do and return Poll::Ready

Ngôn ngữ chính
Rust
Star
7.7k
Fork
947
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
46

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rustls/rustls

Tất cả issue của rustls/rustls

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.