1 /* 2 * Copyright 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /* 18 * Generated mock file from original source file 19 * Functions generated:8 20 * 21 * mockcify.pl ver 0.2 22 */ 23 24 #include <cstdint> 25 #include <functional> 26 #include <map> 27 #include <string> 28 29 extern std::map<std::string, int> mock_function_count_map; 30 31 // Original included files, if any 32 // NOTE: Since this is a mock file with mock definitions some number of 33 // include files may not be required. The include-what-you-use 34 // still applies, but crafting proper inclusion is out of scope 35 // for this effort. This compilation unit may compile as-is, or 36 // may need attention to prune the inclusion set. 37 #include <base/logging.h> 38 #include <base/strings/string_number_conversions.h> 39 #include <algorithm> 40 #include "stack/crypto_toolbox/aes.h" 41 #include "stack/crypto_toolbox/crypto_toolbox.h" 42 43 // Mocked compile conditionals, if any 44 #ifndef UNUSED_ATTR 45 #define UNUSED_ATTR 46 #endif 47 48 namespace test { 49 namespace mock { 50 namespace stack_crypto_toolbox { 51 52 // Shared state between mocked functions and tests 53 // Name: h6 54 // Params: const Octet16& w, std::array<uint8_t, 4> keyid 55 // Returns: Octet16 56 struct h6 { 57 Octet16 octet16; 58 std::function<Octet16(const Octet16& w, std::array<uint8_t, 4> keyid)> body{ 59 [this](const Octet16& w, std::array<uint8_t, 4> keyid) { 60 return octet16; 61 }}; operatorh662 Octet16 operator()(const Octet16& w, std::array<uint8_t, 4> keyid) { 63 return body(w, keyid); 64 }; 65 }; 66 extern struct h6 h6; 67 // Name: h7 68 // Params: const Octet16& salt, const Octet16& w 69 // Returns: Octet16 70 struct h7 { 71 Octet16 octet16; 72 std::function<Octet16(const Octet16& salt, const Octet16& w)> body{ 73 [this](const Octet16& salt, const Octet16& w) { return octet16; }}; operatorh774 Octet16 operator()(const Octet16& salt, const Octet16& w) { 75 return body(salt, w); 76 }; 77 }; 78 extern struct h7 h7; 79 // Name: f4 80 // Params: const uint8_t* u, const uint8_t* v, const Octet16& x, uint8_t z 81 // Returns: Octet16 82 struct f4 { 83 Octet16 octet16; 84 std::function<Octet16(const uint8_t* u, const uint8_t* v, const Octet16& x, 85 uint8_t z)> 86 body{[this](const uint8_t* u, const uint8_t* v, const Octet16& x, 87 uint8_t z) { return octet16; }}; operatorf488 Octet16 operator()(const uint8_t* u, const uint8_t* v, const Octet16& x, 89 uint8_t z) { 90 return body(u, v, x, z); 91 }; 92 }; 93 extern struct f4 f4; 94 // Name: f5 95 // Params: const uint8_t* w, const Octet16& n1, const Octet16& n2, uint8_t* a1, 96 // uint8_t* a2, Octet16* mac_key, Octet16* ltk Returns: void 97 struct f5 { 98 std::function<void(const uint8_t* w, const Octet16& n1, const Octet16& n2, 99 uint8_t* a1, uint8_t* a2, Octet16* mac_key, Octet16* ltk)> 100 body{[](const uint8_t* w, const Octet16& n1, const Octet16& n2, 101 uint8_t* a1, uint8_t* a2, Octet16* mac_key, Octet16* ltk) {}}; operatorf5102 void operator()(const uint8_t* w, const Octet16& n1, const Octet16& n2, 103 uint8_t* a1, uint8_t* a2, Octet16* mac_key, Octet16* ltk) { 104 body(w, n1, n2, a1, a2, mac_key, ltk); 105 }; 106 }; 107 extern struct f5 f5; 108 // Name: f6 109 // Params: const Octet16& w, const Octet16& n1, const Octet16& n2, const 110 // Octet16& r, uint8_t* iocap, uint8_t* a1, uint8_t* a2 Returns: Octet16 111 struct f6 { 112 Octet16 octet16; 113 std::function<Octet16(const Octet16& w, const Octet16& n1, const Octet16& n2, 114 const Octet16& r, uint8_t* iocap, uint8_t* a1, 115 uint8_t* a2)> 116 body{[this](const Octet16& w, const Octet16& n1, const Octet16& n2, 117 const Octet16& r, uint8_t* iocap, uint8_t* a1, 118 uint8_t* a2) { return octet16; }}; operatorf6119 Octet16 operator()(const Octet16& w, const Octet16& n1, const Octet16& n2, 120 const Octet16& r, uint8_t* iocap, uint8_t* a1, 121 uint8_t* a2) { 122 return body(w, n1, n2, r, iocap, a1, a2); 123 }; 124 }; 125 extern struct f6 f6; 126 // Name: g2 127 // Params: const uint8_t* u, const uint8_t* v, const Octet16& x, const Octet16& 128 // y Returns: uint32_t 129 struct g2 { 130 std::function<uint32_t(const uint8_t* u, const uint8_t* v, const Octet16& x, 131 const Octet16& y)> 132 body{[](const uint8_t* u, const uint8_t* v, const Octet16& x, 133 const Octet16& y) { return 0; }}; operatorg2134 uint32_t operator()(const uint8_t* u, const uint8_t* v, const Octet16& x, 135 const Octet16& y) { 136 return body(u, v, x, y); 137 }; 138 }; 139 extern struct g2 g2; 140 // Name: ltk_to_link_key 141 // Params: const Octet16& ltk, bool use_h7 142 // Returns: Octet16 143 struct ltk_to_link_key { 144 Octet16 octet16; 145 std::function<Octet16(const Octet16& ltk, bool use_h7)> body{ 146 [this](const Octet16& ltk, bool use_h7) { return octet16; }}; operatorltk_to_link_key147 Octet16 operator()(const Octet16& ltk, bool use_h7) { 148 return body(ltk, use_h7); 149 }; 150 }; 151 extern struct ltk_to_link_key ltk_to_link_key; 152 // Name: link_key_to_ltk 153 // Params: const Octet16& link_key, bool use_h7 154 // Returns: Octet16 155 struct link_key_to_ltk { 156 Octet16 octet16; 157 std::function<Octet16(const Octet16& link_key, bool use_h7)> body{ 158 [this](const Octet16& link_key, bool use_h7) { return octet16; }}; operatorlink_key_to_ltk159 Octet16 operator()(const Octet16& link_key, bool use_h7) { 160 return body(link_key, use_h7); 161 }; 162 }; 163 extern struct link_key_to_ltk link_key_to_ltk; 164 165 } // namespace stack_crypto_toolbox 166 } // namespace mock 167 } // namespace test 168 169 // END mockcify generation 170