bilibili / openssl Goto Github PK
View Code? Open in Web Editor NEWmirror of https://www.openssl.org
License: Apache License 2.0
mirror of https://www.openssl.org
License: Apache License 2.0
Copyright (c) 1998-2018 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson All rights reserved. DESCRIPTION ----------- The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, fully featured, and Open Source toolkit implementing the Transport Layer Security (TLS) protocols (including SSLv3) as well as a full-strength general purpose cryptographic library. OpenSSL is descended from the SSLeay library developed by Eric A. Young and Tim J. Hudson. The OpenSSL toolkit is licensed under the Apache License 2.0, which means that you are free to get and use it for commercial and non-commercial purposes as long as you fulfill its conditions. OVERVIEW -------- The OpenSSL toolkit includes: libssl (with platform specific naming): Provides the client and server-side implementations for SSLv3 and TLS. libcrypto (with platform specific naming): Provides general cryptographic and X.509 support needed by SSL/TLS but not logically part of it. openssl: A command line tool that can be used for: Creation of key parameters Creation of X.509 certificates, CSRs and CRLs Calculation of message digests Encryption and decryption SSL/TLS client and server tests Handling of S/MIME signed or encrypted mail And more... INSTALLATION ------------ See the appropriate file: INSTALL Linux, Unix, Windows, OpenVMS, ... NOTES.* INSTALL addendums for different platforms SUPPORT ------- See the OpenSSL website www.openssl.org for details on how to obtain commercial technical support. Free community support is available through the openssl-users email list (see https://www.openssl.org/community/mailinglists.html for further details). If you have any problems with OpenSSL then please take the following steps first: - Download the latest version from the repository to see if the problem has already been addressed - Configure with no-asm - Remove compiler optimization flags If you wish to report a bug then please include the following information and create an issue on GitHub: - OpenSSL version: output of 'openssl version -a' - Configuration data: output of 'perl configdata.pm --dump' - OS Name, Version, Hardware platform - Compiler Details (name, version) - Application Details (name, version) - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. Use the openssl-users email list for this type of query. HOW TO CONTRIBUTE TO OpenSSL ---------------------------- See CONTRIBUTING LEGALITIES ---------- A number of nations restrict the use or export of cryptography. If you are potentially subject to such restrictions you should seek competent professional legal advice before attempting to develop or distribute cryptographic code.
请问什么时候更新openssl版本到version 1_1_1 ? 目前的版本1_0_2存在安全漏洞.
Hello,
I noticed that the version of OpenSSL in this repo is subject to a recent security vulnerability (https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3449). The issue can be resolved by updating to the latest version of OpenSSL or applying the following patch to ssl/statem/extensions.c (the line numbers in the patch might not exactly line up depending on what version of OpenSSL you have):
@@ -1137,8 +1137,9 @@
static int init_sig_algs(SSL *s, unsigned int context)
{
/* Clear any signature algorithms extension received */
OPENSSL_free(s->s3->tmp.peer_sigalgs);
s->s3->tmp.peer_sigalgs = NULL;
+ s->s3->tmp.peer_sigalgslen = 0;
return 1;
}
I get the following error when I try to run the below code for a DTLS client server program using rust through visual studio code and its terminal. I have already installed openssl libraries using vcpkg and set the environment variables. I have also installed the c/c++ extensions for vscode.
Error: error: could not find native static library C, perhaps an -L flag is missing?
How do I resolve this error? My DTLS code is given below along with build.rs and cargo.toml. I get the same error when I try to run any openssl-dependant codes in C/C++/Rust.
'''
use openssl::ssl::SslMethod;
use std::{ io::{Read, Write},
net::UdpSocket, thread, time::Duration, };
use udp_dtls::{Certificate, DtlsAcceptor, DtlsConnector, Identity, SrtpProfile};
use udp_dtls::{DtlsAcceptorBuilder, UdpChannel};
fn main() { let buffer = include_bytes!("../test/identity.p12");
let identity = Identity::from_pkcs12(buffer, "mypass").unwrap();
let root_ca = include_bytes!("../test/root-ca.der"); let root_ca = Certificate::from_der(root_ca).unwrap();
let acceptor = DtlsAcceptor::builder(identity).build().unwrap();
let connector = DtlsConnector::builder() .add_srtp_profile(SrtpProfile::Aes128CmSha180) .add_srtp_profile(SrtpProfile::AeadAes256Gcm) .add_root_certificate(root_ca) .build() .unwrap();
let server = UdpSocket::bind("127.0.0.1:0").unwrap();
let client = UdpSocket::bind("127.0.0.1:0").unwrap();
let server_addr = server.local_addr().unwrap(); let client_addr = client.local_addr().unwrap();
let server_channel = UdpChannel { socket: server, remote_addr: client_addr, };
let client_channel = UdpChannel { socket: client, remote_addr: server_addr, };
let guard = thread::spawn(move || { let mut dtls_server = acceptor.accept(server_channel).unwrap(); let mut count = 0;
while true { let mut received = [0; 5];
dtls_server.read_exact(&mut received);
println!( "{:?} {:?}", count, String::from_utf8_lossy(received.as_ref()) );
count = count + 1; thread::sleep(Duration::from_millis(2)); } });
let mut dtls_client = connector.connect("foobar.com", client_channel).unwrap();
while true { let mut buf = [0; 5];
let buf = b"hello";
dtls_client.write_all(buf);
thread::sleep(Duration::from_millis(30)); } }
'''
CARGO.toml
'''
[package]
name = "udp-dtls"
version = "0.1.0"
authors = ["Timon Post https://github.com/TimonPost"]
edition = "2018"
description = "DTLS abstraction ontop of UDP"
repository = "https://github.com/TimonPost/udp-dtls"
documentation = "https://docs.rs/udp-dtls/"
license = "MIT"
keywords = ["DTLS", "UDP", "connection", "openssl", "ssl"] exclude = ["target", "Cargo.lock"] readme = "README.md" [dependencies] openssl = "0.10.19" openssl-probe = "0.1.2" log = "0.4.6" bytes = "0.4.11" [features] vendored = ["openssl/vendored"]
'''
BUILD.rs
'''
BUILD.rs
use std::fs::File;
use std::io::Write;
use std::process::Command;
use std::env;
fn main() -> std::io::Result<()> {
if let Ok(v) = env::var("DEP_OPENSSL_VERSION_NUMBER") {
let version = u64::from_str_radix(&v, 16).unwrap();
if version >= 0x1_01_01_00_0 {
println!("cargo:rustc-cfg=openssl111");
}
}
let certs_dir = "src/certs";
let keys_dir = "src/keys";
let scratch_dir = "openssl-temp";
let server_ext = &format!("{}/server_ext", scratch_dir);
let client_ext = &format!("{}/client_ext", scratch_dir);
for dir in &[certs_dir, keys_dir, scratch_dir] {
// create if dir does not exist
match std::fs::create_dir(dir) {
_ => {}
}
}
let mut file = File::create(server_ext).unwrap();
file.write(b"basicConstraints=CA:false\nkeyUsage=critical,keyEncipherment")?;
let mut file = File::create(client_ext).unwrap();
file.write(b"basicConstraints=CA:false\nkeyUsage=critical,digitalSignature")?;
// Generate self-signed CA
Command::new("openssl")
.args(&[
"req",
"-x509",
"-newkey",
"rsa:2048",
"-subj",
"/CN=ca",
"-nodes",
"-keyout",
&format!("{}/ca-key.pem", keys_dir),
"-out",
&format!("{}/ca-cert.pem", certs_dir),
"-addext",
"keyUsage=critical,keyCertSign",
])
.output()?;
// Generate server key and CSR
Command::new("openssl")
.args(&[
"req",
"-newkey",
"rsa:2048",
"-subj",
"/CN=server",
"-nodes",
"-keyout",
&format!("{}/server-key.pem", keys_dir),
"-out",
&format!("{}/server-csr.pem", scratch_dir),
])
.output()?;
// Sign server CSR
Command::new("openssl")
.args(&[
"x509",
"-req",
"-CAcreateserial",
"-CA",
&format!("{}/ca-cert.pem", certs_dir),
"-CAkey",
&format!("{}/ca-key.pem", keys_dir),
"-in",
&format!("{}/server-csr.pem", scratch_dir),
"-out",
&format!("{}/server-cert.pem", certs_dir),
"-extfile",
server_ext,
])
.output()?;
// Generate client key and CSR
Command::new("openssl")
.args(&[
"req",
"-newkey",
"rsa:2048",
"-subj",
"/CN=client",
"-nodes",
"-keyout",
&format!("{}/client-key.pem", keys_dir),
"-out",
&format!("{}/client-csr.pem", scratch_dir),
])
.output()?;
// Sign client CSR
Command::new("openssl")
.args(&[
"x509",
"-req",
"-CAcreateserial",
"-CA",
&format!("{}/ca-cert.pem", certs_dir),
"-CAkey",
&format!("{}/ca-key.pem", keys_dir),
"-in",
&format!("{}/client-csr.pem", scratch_dir),
"-out",
&format!("{}/client-cert.pem", certs_dir),
"-extfile",
client_ext,
])
.output()?;
std::fs::remove_dir_all(scratch_dir)?;
Ok(())
}
'''
For further reference please check this link for full code: https://github.com/TimonPost/udp-dtls
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.