Skip to content

Commit 9db259a

Browse files
authored
Merge pull request #2084 from alex/more-bad-ciphers
Expose a few more (bad) ciphers in cipher::Cipher
2 parents 83140c5 + 3cab63c commit 9db259a

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-0
lines changed

openssl-sys/src/handwritten/evp.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,10 @@ extern "C" {
312312
pub fn EVP_des_ecb() -> *const EVP_CIPHER;
313313
pub fn EVP_des_ede3() -> *const EVP_CIPHER;
314314
pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER;
315+
pub fn EVP_des_ede3_ecb() -> *const EVP_CIPHER;
315316
pub fn EVP_des_ede3_cfb64() -> *const EVP_CIPHER;
317+
pub fn EVP_des_ede3_cfb8() -> *const EVP_CIPHER;
318+
pub fn EVP_des_ede3_ofb() -> *const EVP_CIPHER;
316319
pub fn EVP_des_cbc() -> *const EVP_CIPHER;
317320
#[cfg(not(osslconf = "OPENSSL_NO_RC4"))]
318321
pub fn EVP_rc4() -> *const EVP_CIPHER;
@@ -398,31 +401,41 @@ extern "C" {
398401
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
399402
pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER;
400403
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
404+
pub fn EVP_camellia_128_ofb() -> *const EVP_CIPHER;
405+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
401406
pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
402407
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
403408
pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
404409
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
405410
pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER;
406411
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
412+
pub fn EVP_camellia_192_ofb() -> *const EVP_CIPHER;
413+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
407414
pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
408415
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
409416
pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
410417
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
411418
pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER;
419+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
420+
pub fn EVP_camellia_256_ofb() -> *const EVP_CIPHER;
412421

413422
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
414423
pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
415424
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
416425
pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
417426
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
418427
pub fn EVP_cast5_cbc() -> *const EVP_CIPHER;
428+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
429+
pub fn EVP_cast5_ofb() -> *const EVP_CIPHER;
419430

420431
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
421432
pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
422433
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
423434
pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
424435
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
425436
pub fn EVP_idea_cbc() -> *const EVP_CIPHER;
437+
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
438+
pub fn EVP_idea_ofb() -> *const EVP_CIPHER;
426439

427440
#[cfg(not(ossl110))]
428441
pub fn OPENSSL_add_all_algorithms_noconf();

openssl/src/cipher.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ impl Cipher {
388388
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_ecb() as *mut _) }
389389
}
390390

391+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
392+
pub fn camellia128_cbc() -> &'static CipherRef {
393+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cbc() as *mut _) }
394+
}
395+
391396
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
392397
pub fn camellia192_cfb128() -> &'static CipherRef {
393398
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cfb128() as *mut _) }
@@ -398,6 +403,11 @@ impl Cipher {
398403
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_ecb() as *mut _) }
399404
}
400405

406+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
407+
pub fn camellia192_cbc() -> &'static CipherRef {
408+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cbc() as *mut _) }
409+
}
410+
401411
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
402412
pub fn camellia256_cfb128() -> &'static CipherRef {
403413
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cfb128() as *mut _) }
@@ -408,6 +418,11 @@ impl Cipher {
408418
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_ecb() as *mut _) }
409419
}
410420

421+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
422+
pub fn camellia256_cbc() -> &'static CipherRef {
423+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cbc() as *mut _) }
424+
}
425+
411426
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
412427
pub fn cast5_cfb64() -> &'static CipherRef {
413428
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cfb64() as *mut _) }
@@ -418,6 +433,11 @@ impl Cipher {
418433
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_ecb() as *mut _) }
419434
}
420435

436+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
437+
pub fn cast5_cbc() -> &'static CipherRef {
438+
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cbc() as *mut _) }
439+
}
440+
421441
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
422442
pub fn idea_cfb64() -> &'static CipherRef {
423443
unsafe { CipherRef::from_ptr(ffi::EVP_idea_cfb64() as *mut _) }
@@ -428,6 +448,11 @@ impl Cipher {
428448
unsafe { CipherRef::from_ptr(ffi::EVP_idea_ecb() as *mut _) }
429449
}
430450

451+
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
452+
pub fn idea_cbc() -> &'static CipherRef {
453+
unsafe { CipherRef::from_ptr(ffi::EVP_idea_cbc() as *mut _) }
454+
}
455+
431456
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
432457
pub fn chacha20() -> &'static CipherRef {
433458
unsafe { CipherRef::from_ptr(ffi::EVP_chacha20() as *mut _) }

openssl/src/symm.rs

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,25 @@ impl Cipher {
278278
unsafe { Cipher(ffi::EVP_des_ede3_cbc()) }
279279
}
280280

281+
pub fn des_ede3_ecb() -> Cipher {
282+
unsafe { Cipher(ffi::EVP_des_ede3_ecb()) }
283+
}
284+
281285
#[cfg(not(boringssl))]
282286
pub fn des_ede3_cfb64() -> Cipher {
283287
unsafe { Cipher(ffi::EVP_des_ede3_cfb64()) }
284288
}
285289

290+
#[cfg(not(boringssl))]
291+
pub fn des_ede3_cfb8() -> Cipher {
292+
unsafe { Cipher(ffi::EVP_des_ede3_cfb8()) }
293+
}
294+
295+
#[cfg(not(boringssl))]
296+
pub fn des_ede3_ofb() -> Cipher {
297+
unsafe { Cipher(ffi::EVP_des_ede3_ofb()) }
298+
}
299+
286300
#[cfg(not(osslconf = "OPENSSL_NO_RC4"))]
287301
pub fn rc4() -> Cipher {
288302
unsafe { Cipher(ffi::EVP_rc4()) }
@@ -293,21 +307,81 @@ impl Cipher {
293307
unsafe { Cipher(ffi::EVP_camellia_128_cbc()) }
294308
}
295309

310+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
311+
pub fn camellia_128_ecb() -> Cipher {
312+
unsafe { Cipher(ffi::EVP_camellia_128_ecb()) }
313+
}
314+
315+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
316+
pub fn camellia_128_ofb() -> Cipher {
317+
unsafe { Cipher(ffi::EVP_camellia_128_ofb()) }
318+
}
319+
320+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
321+
pub fn camellia_128_cfb128() -> Cipher {
322+
unsafe { Cipher(ffi::EVP_camellia_128_cfb128()) }
323+
}
324+
296325
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
297326
pub fn camellia_192_cbc() -> Cipher {
298327
unsafe { Cipher(ffi::EVP_camellia_192_cbc()) }
299328
}
300329

330+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
331+
pub fn camellia_192_ecb() -> Cipher {
332+
unsafe { Cipher(ffi::EVP_camellia_192_ecb()) }
333+
}
334+
335+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
336+
pub fn camellia_192_ofb() -> Cipher {
337+
unsafe { Cipher(ffi::EVP_camellia_192_ofb()) }
338+
}
339+
340+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
341+
pub fn camellia_192_cfb128() -> Cipher {
342+
unsafe { Cipher(ffi::EVP_camellia_192_cfb128()) }
343+
}
344+
301345
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
302346
pub fn camellia_256_cbc() -> Cipher {
303347
unsafe { Cipher(ffi::EVP_camellia_256_cbc()) }
304348
}
305349

350+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
351+
pub fn camellia_256_ecb() -> Cipher {
352+
unsafe { Cipher(ffi::EVP_camellia_256_ecb()) }
353+
}
354+
355+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
356+
pub fn camellia_256_ofb() -> Cipher {
357+
unsafe { Cipher(ffi::EVP_camellia_256_ofb()) }
358+
}
359+
360+
#[cfg(not(osslconf = "OPENSSL_NO_CAMELLIA"))]
361+
pub fn camellia_256_cfb128() -> Cipher {
362+
unsafe { Cipher(ffi::EVP_camellia_256_cfb128()) }
363+
}
364+
306365
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
307366
pub fn cast5_cbc() -> Cipher {
308367
unsafe { Cipher(ffi::EVP_cast5_cbc()) }
309368
}
310369

370+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
371+
pub fn cast5_ecb() -> Cipher {
372+
unsafe { Cipher(ffi::EVP_cast5_ecb()) }
373+
}
374+
375+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
376+
pub fn cast5_ofb() -> Cipher {
377+
unsafe { Cipher(ffi::EVP_cast5_ofb()) }
378+
}
379+
380+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
381+
pub fn cast5_cfb64() -> Cipher {
382+
unsafe { Cipher(ffi::EVP_cast5_cfb64()) }
383+
}
384+
311385
/// Requires OpenSSL 1.1.0 or newer.
312386
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
313387
pub fn chacha20() -> Cipher {
@@ -325,6 +399,21 @@ impl Cipher {
325399
unsafe { Cipher(ffi::EVP_idea_cbc()) }
326400
}
327401

402+
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
403+
pub fn idea_ecb() -> Cipher {
404+
unsafe { Cipher(ffi::EVP_idea_ecb()) }
405+
}
406+
407+
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
408+
pub fn idea_ofb() -> Cipher {
409+
unsafe { Cipher(ffi::EVP_idea_ofb()) }
410+
}
411+
412+
#[cfg(not(osslconf = "OPENSSL_NO_IDEA"))]
413+
pub fn idea_cfb64() -> Cipher {
414+
unsafe { Cipher(ffi::EVP_idea_cfb64()) }
415+
}
416+
328417
#[cfg(not(osslconf = "OPENSSL_NO_SEED"))]
329418
pub fn seed_cbc() -> Cipher {
330419
unsafe { Cipher(ffi::EVP_seed_cbc()) }

0 commit comments

Comments
 (0)