Giter Site home page Giter Site logo

rust-openssl's Introduction

rust-openssl

Build Status

See the rustdoc output.

Building

rust-openssl depends on both the OpenSSL runtime libraries and headers.

Linux

On Linux, you can install OpenSSL via your package manager. The headers are sometimes provided in a separate package than the runtime libraries - look for something like openssl-devel or libssl-dev.

# On Ubuntu
sudo apt-get install libssl-dev
# On Arch Linux
sudo pacman -S openssl

OSX

OpenSSL 0.9.8 is preinstalled on OSX. Some features are only available when linking against OpenSSL 1.0.0 or greater; see below on how to point rust-openssl to a separate installation.

Windows

Install OpenSSL from here. Cargo will not be able to find OpenSSL if it's installed to the default location. You can either copy the include/openssl directory, libssl32.dll, and libeay32.dll to locations that Cargo can find or pass the location to Cargo via environment variables:

env OPENSSL_LIB_DIR=/c/OpenSSL-Win64 OPENSSL_INCLUDE_DIR=/c/OpenSSL-Win64/include cargo build

Manual configuration

rust-openssl's build script will by default attempt to locate OpenSSL via pkg-config. This will not work in some situations, for example, on systems that don't have pkg-config, when cross compiling, or when using a copy of OpenSSL other than the normal system install.

The build script can be configured via environment variables:

  • OPENSSL_LIB_DIR - If specified, a directory that will be used to find OpenSSL runtime libraries.
  • OPENSSL_INCLUDE_DIR - If specified, a directory that will be used to find OpenSSL headers.
  • OPENSSL_STATIC - If specified, OpenSSL libraries will be statically rather than dynamically linked.

If either OPENSSL_LIB_DIR or OPENSSL_INCLUDE_DIR are specified, then the build script will skip the pkg-config step.

Testing

Several tests expect a local test server to be running to bounce requests off of. It's easy to do this. Open a separate terminal window and cd to the rust-openssl directory. Then run one of the following commands:

  • Windows: openssl s_server -accept 15418 -www -cert test/cert.pem -key test/key.pem > NUL
  • Linux: openssl s_server -accept 15418 -www -cert test/cert.pem -key test/key.pem >/dev/null

Then in the original terminal, run cargo test. If everything is set up correctly, all tests should pass. You might get some warnings in the openssl s_server window. Those aren't anything to worry about. You can stop the server using Control-C.

rust-openssl's People

Contributors

sfackler avatar vhbit avatar lilyball avatar erickt avatar cjcole avatar alexcrichton avatar codyps avatar gkoz avatar mlalic avatar ebfe avatar diamondlovesyou avatar randombit avatar jroesch avatar andrew-d avatar ccole-juniper avatar aatxe avatar abonander avatar noxivs avatar pyrho avatar zzmp avatar bombless avatar wg avatar kinghajj avatar xorpse avatar quentinbaradat avatar reaperhulk avatar mvdnes avatar manishearth avatar ryman avatar chris-morgan avatar

Watchers

Florian Hartwig avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.