diff options
| author | Steven Fackler <[email protected]> | 2014-06-29 13:36:02 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-06-29 13:36:02 -0700 |
| commit | 8c40c2ef3527fbcf22f11a517422b371b4626852 (patch) | |
| tree | 03fd71358fd3790628331932a77fd4adf9e55baa /crypto | |
| parent | Drop to version 0.0.0 (diff) | |
| download | rust-openssl-8c40c2ef3527fbcf22f11a517422b371b4626852.tar.xz rust-openssl-8c40c2ef3527fbcf22f11a517422b371b4626852.zip | |
Update for * -> *const change
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/hash.rs | 44 | ||||
| -rw-r--r-- | crypto/hmac.rs | 8 | ||||
| -rw-r--r-- | crypto/pkcs5.rs | 4 | ||||
| -rw-r--r-- | crypto/pkey.rs | 44 | ||||
| -rw-r--r-- | crypto/symm.rs | 8 |
5 files changed, 54 insertions, 54 deletions
diff --git a/crypto/hash.rs b/crypto/hash.rs index d03b0317..1a1b6e8a 100644 --- a/crypto/hash.rs +++ b/crypto/hash.rs @@ -14,12 +14,12 @@ pub enum HashType { #[allow(dead_code)] #[allow(non_camel_case_types)] pub struct EVP_MD_CTX { - digest: *EVP_MD, - engine: *libc::c_void, + digest: *mut EVP_MD, + engine: *mut libc::c_void, flags: libc::c_ulong, - md_data: *libc::c_void, - pctx: *EVP_PKEY_CTX, - update: *libc::c_void + md_data: *mut libc::c_void, + pctx: *mut EVP_PKEY_CTX, + update: *mut libc::c_void } #[allow(non_camel_case_types)] @@ -30,22 +30,22 @@ pub struct EVP_PKEY_CTX; #[link(name = "crypto")] extern { - fn EVP_MD_CTX_create() -> *EVP_MD_CTX; - fn EVP_MD_CTX_destroy(ctx: *EVP_MD_CTX); - - fn EVP_md5() -> *EVP_MD; - fn EVP_sha1() -> *EVP_MD; - fn EVP_sha224() -> *EVP_MD; - fn EVP_sha256() -> *EVP_MD; - fn EVP_sha384() -> *EVP_MD; - fn EVP_sha512() -> *EVP_MD; - - fn EVP_DigestInit(ctx: *EVP_MD_CTX, typ: *EVP_MD); - fn EVP_DigestUpdate(ctx: *EVP_MD_CTX, data: *u8, n: c_uint); - fn EVP_DigestFinal(ctx: *EVP_MD_CTX, res: *mut u8, n: *u32); + fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX; + fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX); + + fn EVP_md5() -> *const EVP_MD; + fn EVP_sha1() -> *const EVP_MD; + fn EVP_sha224() -> *const EVP_MD; + fn EVP_sha256() -> *const EVP_MD; + fn EVP_sha384() -> *const EVP_MD; + fn EVP_sha512() -> *const EVP_MD; + + fn EVP_DigestInit(ctx: *mut EVP_MD_CTX, typ: *const EVP_MD); + fn EVP_DigestUpdate(ctx: *mut EVP_MD_CTX, data: *const u8, n: c_uint); + fn EVP_DigestFinal(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32); } -pub fn evpmd(t: HashType) -> (*EVP_MD, uint) { +pub fn evpmd(t: HashType) -> (*const EVP_MD, uint) { unsafe { match t { MD5 => (EVP_md5(), 16u), @@ -60,8 +60,8 @@ pub fn evpmd(t: HashType) -> (*EVP_MD, uint) { #[allow(dead_code)] pub struct Hasher { - evp: *EVP_MD, - ctx: *EVP_MD_CTX, + evp: *const EVP_MD, + ctx: *mut EVP_MD_CTX, len: uint, } @@ -90,7 +90,7 @@ impl Hasher { pub fn final(&self) -> Vec<u8> { unsafe { let mut res = Vec::from_elem(self.len, 0u8); - EVP_DigestFinal(self.ctx, res.as_mut_ptr(), ptr::null()); + EVP_DigestFinal(self.ctx, res.as_mut_ptr(), ptr::mut_null()); res } } diff --git a/crypto/hmac.rs b/crypto/hmac.rs index d9e53c99..16be0f29 100644 --- a/crypto/hmac.rs +++ b/crypto/hmac.rs @@ -20,7 +20,7 @@ use crypto::hash; #[allow(dead_code)] #[allow(non_camel_case_types)] pub struct HMAC_CTX { - md: *hash::EVP_MD, + md: *mut hash::EVP_MD, md_ctx: hash::EVP_MD_CTX, i_ctx: hash::EVP_MD_CTX, o_ctx: hash::EVP_MD_CTX, @@ -31,8 +31,8 @@ pub struct HMAC_CTX { #[link(name = "crypto")] extern { fn HMAC_CTX_init(ctx: *mut HMAC_CTX); - fn HMAC_Init_ex(ctx: *mut HMAC_CTX, key: *u8, keylen: c_int, md: *hash::EVP_MD, imple: *ENGINE); - fn HMAC_Update(ctx: *mut HMAC_CTX, input: *u8, len: c_uint); + fn HMAC_Init_ex(ctx: *mut HMAC_CTX, key: *const u8, keylen: c_int, md: *const hash::EVP_MD, imple: *const ENGINE); + fn HMAC_Update(ctx: *mut HMAC_CTX, input: *const u8, len: c_uint); fn HMAC_Final(ctx: *mut HMAC_CTX, output: *mut u8, len: *mut c_uint); } @@ -55,7 +55,7 @@ pub fn HMAC(ht: hash::HashType, key: &[u8]) -> HMAC { HMAC_Init_ex(&mut ctx, key.as_ptr(), key.len() as c_int, - evp, 0 as *_); + evp, 0 as *const _); HMAC { ctx: ctx, len: mdlen } } diff --git a/crypto/pkcs5.rs b/crypto/pkcs5.rs index 06fc1bb9..b795d84a 100644 --- a/crypto/pkcs5.rs +++ b/crypto/pkcs5.rs @@ -2,8 +2,8 @@ use libc::c_int; #[link(name = "crypto")] extern { - fn PKCS5_PBKDF2_HMAC_SHA1(pass: *u8, passlen: c_int, - salt: *u8, saltlen: c_int, + fn PKCS5_PBKDF2_HMAC_SHA1(pass: *const u8, passlen: c_int, + salt: *const u8, saltlen: c_int, iter: c_int, keylen: c_int, out: *mut u8) -> c_int; } diff --git a/crypto/pkey.rs b/crypto/pkey.rs index 6c0b4e83..5f617fa7 100644 --- a/crypto/pkey.rs +++ b/crypto/pkey.rs @@ -5,34 +5,34 @@ use std::ptr; use crypto::hash::{HashType, MD5, SHA1, SHA224, SHA256, SHA384, SHA512}; #[allow(non_camel_case_types)] -pub type EVP_PKEY = *libc::c_void; +pub type EVP_PKEY = *mut libc::c_void; #[allow(non_camel_case_types)] -pub type RSA = *libc::c_void; +pub type RSA = *mut libc::c_void; #[link(name = "crypto")] extern { - fn EVP_PKEY_new() -> *EVP_PKEY; - fn EVP_PKEY_free(k: *EVP_PKEY); - fn EVP_PKEY_assign(pkey: *EVP_PKEY, typ: c_int, key: *c_char) -> c_int; - fn EVP_PKEY_get1_RSA(k: *EVP_PKEY) -> *RSA; + fn EVP_PKEY_new() -> *mut EVP_PKEY; + fn EVP_PKEY_free(k: *mut EVP_PKEY); + fn EVP_PKEY_assign(pkey: *mut EVP_PKEY, typ: c_int, key: *const c_char) -> c_int; + fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA; - fn i2d_PublicKey(k: *EVP_PKEY, buf: **mut u8) -> c_int; - fn d2i_PublicKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY; - fn i2d_PrivateKey(k: *EVP_PKEY, buf: **mut u8) -> c_int; - fn d2i_PrivateKey(t: c_int, k: **EVP_PKEY, buf: **u8, len: c_uint) -> *EVP_PKEY; + fn i2d_PublicKey(k: *mut EVP_PKEY, buf: *const *mut u8) -> c_int; + fn d2i_PublicKey(t: c_int, k: *const *mut EVP_PKEY, buf: *const *const u8, len: c_uint) -> *mut EVP_PKEY; + fn i2d_PrivateKey(k: *mut EVP_PKEY, buf: *const *mut u8) -> c_int; + fn d2i_PrivateKey(t: c_int, k: *const *mut EVP_PKEY, buf: *const *const u8, len: c_uint) -> *mut EVP_PKEY; - fn RSA_generate_key(modsz: c_uint, e: c_uint, cb: *u8, cbarg: *u8) -> *RSA; - fn RSA_size(k: *RSA) -> c_uint; + fn RSA_generate_key(modsz: c_uint, e: c_uint, cb: *const u8, cbarg: *const u8) -> *mut RSA; + fn RSA_size(k: *mut RSA) -> c_uint; - fn RSA_public_encrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA, + fn RSA_public_encrypt(flen: c_uint, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int) -> c_int; - fn RSA_private_decrypt(flen: c_uint, from: *u8, to: *mut u8, k: *RSA, + fn RSA_private_decrypt(flen: c_uint, from: *const u8, to: *mut u8, k: *mut RSA, pad: c_int) -> c_int; - fn RSA_sign(t: c_int, m: *u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint, - k: *RSA) -> c_int; - fn RSA_verify(t: c_int, m: *u8, mlen: c_uint, sig: *u8, siglen: c_uint, - k: *RSA) -> c_int; + fn RSA_sign(t: c_int, m: *const u8, mlen: c_uint, sig: *mut u8, siglen: *mut c_uint, + k: *mut RSA) -> c_int; + fn RSA_verify(t: c_int, m: *const u8, mlen: c_uint, sig: *const u8, siglen: c_uint, + k: *mut RSA) -> c_int; } enum Parts { @@ -74,7 +74,7 @@ fn openssl_hash_nid(hash: HashType) -> c_int { } pub struct PKey { - evp: *EVP_PKEY, + evp: *mut EVP_PKEY, parts: Parts, } @@ -89,7 +89,7 @@ impl PKey { } } - fn _tostr(&self, f: unsafe extern "C" fn(*EVP_PKEY, **mut u8) -> c_int) -> Vec<u8> { + fn _tostr(&self, f: unsafe extern "C" fn(*mut EVP_PKEY, *const *mut u8) -> c_int) -> Vec<u8> { unsafe { let len = f(self.evp, ptr::null()); if len < 0 as c_int { return vec!(); } @@ -102,9 +102,9 @@ impl PKey { } } - fn _fromstr(&mut self, s: &[u8], f: unsafe extern "C" fn(c_int, **EVP_PKEY, **u8, c_uint) -> *EVP_PKEY) { + fn _fromstr(&mut self, s: &[u8], f: unsafe extern "C" fn(c_int, *const *mut EVP_PKEY, *const *const u8, c_uint) -> *mut EVP_PKEY) { unsafe { - let evp = ptr::null(); + let evp = ptr::mut_null(); f(6 as c_int, &evp, &s.as_ptr(), s.len() as c_uint); self.evp = evp; } diff --git a/crypto/symm.rs b/crypto/symm.rs index dbdb4b5c..8d8f651c 100644 --- a/crypto/symm.rs +++ b/crypto/symm.rs @@ -2,10 +2,10 @@ use libc::{c_int, c_uint}; use libc; #[allow(non_camel_case_types)] -pub type EVP_CIPHER_CTX = *libc::c_void; +pub type EVP_CIPHER_CTX = *mut libc::c_void; #[allow(non_camel_case_types)] -pub type EVP_CIPHER = *libc::c_void; +pub type EVP_CIPHER = *mut libc::c_void; #[link(name = "crypto")] extern { @@ -26,9 +26,9 @@ extern { fn EVP_rc4() -> EVP_CIPHER; fn EVP_CipherInit(ctx: EVP_CIPHER_CTX, evp: EVP_CIPHER, - key: *u8, iv: *u8, mode: c_int); + key: *const u8, iv: *const u8, mode: c_int); fn EVP_CipherUpdate(ctx: EVP_CIPHER_CTX, outbuf: *mut u8, - outlen: &mut c_uint, inbuf: *u8, inlen: c_int); + outlen: &mut c_uint, inbuf: *const u8, inlen: c_int); fn EVP_CipherFinal(ctx: EVP_CIPHER_CTX, res: *mut u8, len: &mut c_int); } |