     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49

    // Copyright 2015 Brian Smith.
    //
    // Permission to use, copy, modify, and/or distribute this software for any
    // purpose with or without fee is hereby granted, provided that the above
    // copyright notice and this permission notice appear in all copies.
    //
    // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
    // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
    // SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
    // OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
    // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

    use {c, error};

    pub fn map_result(bssl_result: c::int) -> Result<(), error::Unspecified> {
        match bssl_result {
            1 => Ok(()),
            _ => Err(error::Unspecified),
        }
    }

    // Adapt a BoringSSL test suite to a Rust test.
    //
    // The BoringSSL test suite is broken up into multiple files. Originally, they
    // were all executables with their own `main` functions. Those main functions
    // have been replaced with uniquely-named functions so that they can all be
    // linked into the same executable.
    #[cfg(test)]
    macro_rules! bssl_test {
        ( $fn_name:ident, $bssl_test_main_fn_name:ident ) => {
            #[test]
            fn $fn_name() {
                use $crate::{c, init};
                extern {
                    fn $bssl_test_main_fn_name() -> c::int;
                }

                init::init_once();
                ::std::env::set_current_dir(::test::ring_src_path()).unwrap();

                let result = unsafe {
                    $bssl_test_main_fn_name()
                };
                assert_eq!(result, 0);
            }
        }
    }

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)