04327a
diff -up firefox-91.2.0/Cargo.toml.fips-quic firefox-91.2.0/Cargo.toml
04327a
--- firefox-91.2.0/Cargo.toml.fips-quic	2021-10-21 09:40:17.235999423 +0200
04327a
+++ firefox-91.2.0/Cargo.toml	2021-10-21 11:21:06.746558028 +0200
04327a
@@ -109,3 +109,12 @@ path = "third_party/rust/failure"
04327a
 
04327a
 [patch.crates-io.prost-derive]
04327a
 path = "third_party/rust/prost-derive"
04327a
+
04327a
+[patch."https://github.com/mozilla/neqo"]
04327a
+neqo-crypto = { path = "third_party/rust/neqo-crypto" }
04327a
+neqo-transport = { path = "third_party/rust/neqo-transport" }
04327a
+neqo-qpack = { path = "third_party/rust/neqo-qpack" }
04327a
+neqo-common = { path = "third_party/rust/neqo-common" }
04327a
+
04327a
+
04327a
+
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/bindings/bindings.toml.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/bindings/bindings.toml
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/bindings/bindings.toml.fips-quic	2021-09-28 18:41:34.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/bindings/bindings.toml	2021-10-21 08:49:01.762221759 +0200
04327a
@@ -163,7 +163,7 @@ functions = [
04327a
     "PK11_GetKeyData",
04327a
     "PK11_GetMechanism",
04327a
     "PK11_HPKE_Serialize",
04327a
-    "PK11_ImportSymKey",
04327a
+    "PK11_ImportDataKey",
04327a
     "PK11_ReadRawAttribute",
04327a
     "PK11_ReferenceSymKey",
04327a
     "SECITEM_FreeItem",
04327a
@@ -196,11 +196,10 @@ variables = [
04327a
     "CKM_AES_ECB",
04327a
     "CKM_AES_GCM",
04327a
     "CKM_EC_KEY_PAIR_GEN",
04327a
+    "CKM_HKDF_DERIVE",
04327a
     "CKM_INVALID_MECHANISM",
04327a
     "CKM_NSS_CHACHA20_CTR",
04327a
     "CKM_NSS_CHACHA20_POLY1305",
04327a
-    "CKM_NSS_HKDF_SHA256",
04327a
-    "CKM_NSS_HKDF_SHA384",
04327a
     "PK11_ATTR_INSENSITIVE",
04327a
     "PK11_ATTR_PRIVATE",
04327a
     "PK11_ATTR_PUBLIC",
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/Cargo.toml.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/Cargo.toml
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/src/hkdf.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/src/hkdf.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/src/hkdf.rs.fips-quic	2021-09-28 18:41:44.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/src/hkdf.rs	2021-10-21 08:49:01.763221763 +0200
04327a
@@ -10,8 +10,8 @@ use crate::constants::{
04327a
 };
04327a
 use crate::err::{Error, Res};
04327a
 use crate::p11::{
04327a
-    random, Item, PK11Origin, PK11SymKey, PK11_ImportSymKey, Slot, SymKey, CKA_DERIVE,
04327a
-    CKM_NSS_HKDF_SHA256, CKM_NSS_HKDF_SHA384, CK_ATTRIBUTE_TYPE, CK_MECHANISM_TYPE,
04327a
+    random, Item, PK11Origin, PK11SymKey, PK11_ImportDataKey, Slot, SymKey, CKA_DERIVE,
04327a
+    CKM_HKDF_DERIVE, CK_ATTRIBUTE_TYPE, CK_MECHANISM_TYPE,
04327a
 };
04327a
 
04327a
 use std::convert::TryFrom;
04327a
@@ -52,27 +52,22 @@ fn key_size(version: Version, cipher: Ci
04327a
 /// # Errors
04327a
 /// Only if NSS fails.
04327a
 pub fn generate_key(version: Version, cipher: Cipher) -> Res<SymKey> {
04327a
-    import_key(version, cipher, &random(key_size(version, cipher)?))
04327a
+    import_key(version, &random(key_size(version, cipher)?))
04327a
 }
04327a
 
04327a
 /// Import a symmetric key for use with HKDF.
04327a
 ///
04327a
 /// # Errors
04327a
 /// Errors returned if the key buffer is an incompatible size or the NSS functions fail.
04327a
-pub fn import_key(version: Version, cipher: Cipher, buf: &[u8]) -> Res<SymKey> {
04327a
+pub fn import_key(version: Version, buf: &[u8]) -> Res<SymKey> {
04327a
     if version != TLS_VERSION_1_3 {
04327a
         return Err(Error::UnsupportedVersion);
04327a
     }
04327a
-    let mech = match cipher {
04327a
-        TLS_AES_128_GCM_SHA256 | TLS_CHACHA20_POLY1305_SHA256 => CKM_NSS_HKDF_SHA256,
04327a
-        TLS_AES_256_GCM_SHA384 => CKM_NSS_HKDF_SHA384,
04327a
-        _ => return Err(Error::UnsupportedCipher),
04327a
-    };
04327a
     let slot = Slot::internal()?;
04327a
     let key_ptr = unsafe {
04327a
-        PK11_ImportSymKey(
04327a
+        PK11_ImportDataKey(
04327a
             *slot,
04327a
-            CK_MECHANISM_TYPE::from(mech),
04327a
+            CK_MECHANISM_TYPE::from(CKM_HKDF_DERIVE),
04327a
             PK11Origin::PK11_OriginUnwrap,
04327a
             CK_ATTRIBUTE_TYPE::from(CKA_DERIVE),
04327a
             &mut Item::wrap(buf),
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/src/selfencrypt.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/src/selfencrypt.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/src/selfencrypt.rs.fips-quic	2021-09-28 18:41:41.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/src/selfencrypt.rs	2021-10-21 08:49:01.763221763 +0200
04327a
@@ -41,7 +41,7 @@ impl SelfEncrypt {
04327a
 
04327a
     fn make_aead(&self, k: &SymKey, salt: &[u8]) -> Res<Aead> {
04327a
         debug_assert_eq!(salt.len(), Self::SALT_LENGTH);
04327a
-        let salt = hkdf::import_key(self.version, self.cipher, salt)?;
04327a
+        let salt = hkdf::import_key(self.version, salt)?;
04327a
         let secret = hkdf::extract(self.version, self.cipher, Some(&salt), k)?;
04327a
         Aead::new(self.version, self.cipher, &secret, "neqo self")
04327a
     }
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/tests/aead.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/tests/aead.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/tests/aead.rs.fips-quic	2021-09-28 18:41:35.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/tests/aead.rs	2021-10-21 08:49:01.764221767 +0200
04327a
@@ -26,7 +26,6 @@ fn make_aead(cipher: Cipher) -> Aead {
04327a
 
04327a
     let secret = hkdf::import_key(
04327a
         TLS_VERSION_1_3,
04327a
-        cipher,
04327a
         &[
04327a
             0x47, 0xb2, 0xea, 0xea, 0x6c, 0x26, 0x6e, 0x32, 0xc0, 0x69, 0x7a, 0x9e, 0x2a, 0x89,
04327a
             0x8b, 0xdf, 0x5c, 0x4f, 0xb3, 0xe5, 0xac, 0x34, 0xf0, 0xe5, 0x49, 0xbf, 0x2c, 0x58,
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/tests/hkdf.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/tests/hkdf.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/tests/hkdf.rs.fips-quic	2021-09-28 18:41:44.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/tests/hkdf.rs	2021-10-21 08:49:01.764221767 +0200
04327a
@@ -38,8 +38,8 @@ fn cipher_hash_len(cipher: Cipher) -> us
04327a
 fn import_keys(cipher: Cipher) -> (SymKey, SymKey) {
04327a
     let l = cipher_hash_len(cipher);
04327a
     (
04327a
-        hkdf::import_key(TLS_VERSION_1_3, cipher, &SALT[0..l]).expect("import salt"),
04327a
-        hkdf::import_key(TLS_VERSION_1_3, cipher, &IKM[0..l]).expect("import IKM"),
04327a
+        hkdf::import_key(TLS_VERSION_1_3, &SALT[0..l]).expect("import salt"),
04327a
+        hkdf::import_key(TLS_VERSION_1_3, &IKM[0..l]).expect("import IKM"),
04327a
     )
04327a
 }
04327a
 
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-crypto/tests/hp.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-crypto/tests/hp.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-crypto/tests/hp.rs.fips-quic	2021-09-28 18:41:44.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-crypto/tests/hp.rs	2021-10-21 08:49:01.764221767 +0200
04327a
@@ -9,7 +9,7 @@ use neqo_crypto::hp::HpKey;
04327a
 use test_fixture::fixture_init;
04327a
 
04327a
 fn make_hp(cipher: Cipher) -> HpKey {
04327a
-    let ikm = hkdf::import_key(TLS_VERSION_1_3, cipher, &[;; 16]).expect("import IKM");
04327a
+    let ikm = hkdf::import_key(TLS_VERSION_1_3, &[;; 16]).expect("import IKM");
04327a
     let prk = hkdf::extract(TLS_VERSION_1_3, cipher, None, &ikm).expect("extract works");
04327a
     HpKey::extract(TLS_VERSION_1_3, cipher, &prk, "hp").expect("extract label works")
04327a
 }
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-http3/Cargo.toml.fips-quic firefox-91.2.0/third_party/rust/neqo-http3/Cargo.toml
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-qpack/Cargo.toml.fips-quic firefox-91.2.0/third_party/rust/neqo-qpack/Cargo.toml
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-transport/Cargo.toml.fips-quic firefox-91.2.0/third_party/rust/neqo-transport/Cargo.toml
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-transport/src/crypto.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-transport/src/crypto.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-transport/src/crypto.rs.fips-quic	2021-09-28 18:41:44.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-transport/src/crypto.rs	2021-10-21 08:49:01.765221771 +0200
04327a
@@ -432,14 +432,8 @@ impl CryptoDxState {
04327a
         let initial_secret = hkdf::extract(
04327a
             TLS_VERSION_1_3,
04327a
             cipher,
04327a
-            Some(
04327a
-                hkdf::import_key(TLS_VERSION_1_3, cipher, salt)
04327a
-                    .as_ref()
04327a
-                    .unwrap(),
04327a
-            ),
04327a
-            hkdf::import_key(TLS_VERSION_1_3, cipher, dcid)
04327a
-                .as_ref()
04327a
-                .unwrap(),
04327a
+            Some(hkdf::import_key(TLS_VERSION_1_3, salt).as_ref().unwrap()),
04327a
+            hkdf::import_key(TLS_VERSION_1_3, dcid).as_ref().unwrap(),
04327a
         )
04327a
         .unwrap();
04327a
 
04327a
@@ -1094,8 +1088,7 @@ impl CryptoStates {
04327a
         let app_read = |epoch| CryptoDxAppData {
04327a
             dx: read(epoch),
04327a
             cipher: TLS_AES_128_GCM_SHA256,
04327a
-            next_secret: hkdf::import_key(TLS_VERSION_1_3, TLS_AES_128_GCM_SHA256, &[0xaa; 32])
04327a
-                .unwrap(),
04327a
+            next_secret: hkdf::import_key(TLS_VERSION_1_3, &[0xaa; 32]).unwrap(),
04327a
         };
04327a
         Self {
04327a
             initial: Some(CryptoState {
04327a
@@ -1120,8 +1113,7 @@ impl CryptoStates {
04327a
             0x00, 0xa1, 0x54, 0x43, 0xf1, 0x82, 0x03, 0xa0, 0x7d, 0x60, 0x60, 0xf6, 0x88, 0xf3,
04327a
             0x0f, 0x21, 0x63, 0x2b,
04327a
         ];
04327a
-        let secret =
04327a
-            hkdf::import_key(TLS_VERSION_1_3, TLS_CHACHA20_POLY1305_SHA256, SECRET).unwrap();
04327a
+        let secret = hkdf::import_key(TLS_VERSION_1_3, SECRET).unwrap();
04327a
         let app_read = |epoch| CryptoDxAppData {
04327a
             dx: CryptoDxState {
04327a
                 direction: CryptoDxDirection::Read,
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-transport/src/packet/retry.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-transport/src/packet/retry.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-transport/src/packet/retry.rs.fips-quic	2021-09-28 18:41:34.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-transport/src/packet/retry.rs	2021-10-21 08:49:01.766221775 +0200
04327a
@@ -28,7 +28,7 @@ fn make_aead(secret: &[u8]) -> Aead {
04327a
     #[cfg(debug_assertions)]
04327a
     ::neqo_crypto::assert_initialized();
04327a
 
04327a
-    let secret = hkdf::import_key(TLS_VERSION_1_3, TLS_AES_128_GCM_SHA256, secret).unwrap();
04327a
+    let secret = hkdf::import_key(TLS_VERSION_1_3, secret).unwrap();
04327a
     Aead::new(TLS_VERSION_1_3, TLS_AES_128_GCM_SHA256, &secret, "quic ").unwrap()
04327a
 }
04327a
 thread_local!(static RETRY_AEAD_29: RefCell<Aead> = RefCell::new(make_aead(RETRY_SECRET_29)));
04327a
diff -up firefox-91.2.0/third_party/rust/neqo-transport/tests/common/mod.rs.fips-quic firefox-91.2.0/third_party/rust/neqo-transport/tests/common/mod.rs
04327a
--- firefox-91.2.0/third_party/rust/neqo-transport/tests/common/mod.rs.fips-quic	2021-09-28 18:41:34.000000000 +0200
04327a
+++ firefox-91.2.0/third_party/rust/neqo-transport/tests/common/mod.rs	2021-10-21 08:49:01.766221775 +0200
04327a
@@ -121,13 +121,11 @@ pub fn client_initial_aead_and_hp(dcid:
04327a
         TLS_VERSION_1_3,
04327a
         TLS_AES_128_GCM_SHA256,
04327a
         Some(
04327a
-            hkdf::import_key(TLS_VERSION_1_3, TLS_AES_128_GCM_SHA256, INITIAL_SALT)
04327a
+            hkdf::import_key(TLS_VERSION_1_3, INITIAL_SALT)
04327a
                 .as_ref()
04327a
                 .unwrap(),
04327a
         ),
04327a
-        hkdf::import_key(TLS_VERSION_1_3, TLS_AES_128_GCM_SHA256, dcid)
04327a
-            .as_ref()
04327a
-            .unwrap(),
04327a
+        hkdf::import_key(TLS_VERSION_1_3, dcid).as_ref().unwrap(),
04327a
     )
04327a
     .unwrap();
04327a