Skip to content

Commit 0d9bd1e

Browse files
committed
Fix wrong ccm key size
1 parent f7783a2 commit 0d9bd1e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

dtls/src/crypto/crypto_ccm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::content::*;
1919
use crate::errors::*;
2020
use crate::record_layer::record_layer_header::*;
2121

22-
use aes::Aes256;
22+
use aes::Aes128;
2323
use ccm::aead::{generic_array::GenericArray, AeadInPlace, NewAead};
2424
use ccm::{
2525
consts::{U12, U16, U8},
@@ -30,8 +30,8 @@ const CRYPTO_CCM_8_TAG_LENGTH: usize = 8;
3030
const CRYPTO_CCM_TAG_LENGTH: usize = 16;
3131
const CRYPTO_CCM_NONCE_LENGTH: usize = 12;
3232

33-
type AesCcm8 = Ccm<Aes256, U8, U12>;
34-
type AesCcm = Ccm<Aes256, U16, U12>;
33+
type AesCcm8 = Ccm<Aes128, U8, U12>;
34+
type AesCcm = Ccm<Aes128, U16, U12>;
3535

3636
#[derive(Clone)]
3737
pub enum CryptoCcmTagLen {

dtls/src/crypto/crypto_test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ fn test_generate_key_signature() -> Result<(), Error> {
107107
fn test_ccm_encryption_and_decryption() -> Result<(), Error> {
108108
let key = vec![
109109
0x18, 0x78, 0xac, 0xc2, 0x2a, 0xd8, 0xbd, 0xd8, 0xc6, 0x01, 0xa6, 0x17, 0x12, 0x6f, 0x63,
110-
0x54, 0x18, 0x78, 0xac, 0xc2, 0x2a, 0xd8, 0xbd, 0xd8, 0xc6, 0x01, 0xa6, 0x17, 0x12, 0x6f,
111-
0x63, 0x54,
110+
0x54,
112111
];
113112
let iv = vec![0x0e, 0xb2, 0x09, 0x06];
114113

0 commit comments

Comments
 (0)