Lines Matching full:name
22 # Dear Pylint, conventionally, a context manager class name is lowercase.
23 # pylint: disable=invalid-name,too-few-public-methods
38 snippet annotates the exception with the file name and line number.
97 # macro name -> list of argument names
99 # argument name -> list of values
112 def is_internal_name(self, name: str) -> bool:
115 if name.endswith('_BASE') or name.endswith('_NONE'):
117 if '_CATEGORY_' in name:
119 return name.endswith('_FLAG') or name.endswith('_MASK')
139 def _format_arguments(name: str, arguments: Iterable[str]) -> str:
145 return name + '(' + ', '.join(arguments) + ')'
152 def distribute_arguments(self, name: str) -> Iterator[str]:
155 If name is a macro without arguments, just yield "name".
156 If name is a macro with arguments, yield a series of
157 "name(arg1,...,argN)" where each argument takes each possible
161 if name not in self.argspecs:
162 yield name
164 argspec = self.argspecs[name]
166 yield name + '()'
170 yield self._format_arguments(name, arguments)
177 yield self._format_arguments(name, arguments)
180 raise Exception('distribute_arguments({})'.format(name)) from e
183 self, seen: Set[str], name: str
186 for result in self.distribute_arguments(name):
205 self.distribute_arguments_without_duplicates(seen, name)
206 for name in names
229 def algorithm_tester(name: str) -> str:
232 The given name must be the name of an algorithm constructor of the
240 assert name.startswith(prefix)
242 suffix = name[len(prefix):]
249 def record_algorithm_subtype(self, name: str, expansion: str) -> None:
252 Given a ``PSA_ALG_xxx`` macro name and its expansion, if the algorithm
258 if re.match(r'MAC(?:_|\Z)', name):
259 self.mac_algorithms.add(name)
260 elif re.match(r'KDF(?:_|\Z)', name):
261 self.kdf_algorithms.add(name)
263 self.hash_algorithms.add(name)
265 self.mac_algorithms.add(name)
267 self.aead_algorithms.add(name)
269 self.ka_algorithms.add(name)
271 self.kdf_algorithms.add(name)
273 # "#define" followed by a macro name with either no parameters
275 # Grab the macro name in group 1, the parameter name if any in group 2
291 name, parameter, expansion = m.groups()
294 self.argspecs[name] = [parameter]
300 if self.is_internal_name(name):
303 elif (name.startswith('PSA_ERROR_') or name == 'PSA_SUCCESS') \
305 self.statuses.add(name)
306 elif name.startswith('PSA_KEY_TYPE_') and not parameter:
307 self.key_types.add(name)
308 elif name.startswith('PSA_KEY_TYPE_') and parameter == 'curve':
309 self.key_types_from_curve[name] = name[:13] + 'IS_' + name[13:]
310 elif name.startswith('PSA_KEY_TYPE_') and parameter == 'group':
311 self.key_types_from_group[name] = name[:13] + 'IS_' + name[13:]
312 elif name.startswith('PSA_ECC_FAMILY_') and not parameter:
313 self.ecc_curves.add(name)
314 elif name.startswith('PSA_DH_FAMILY_') and not parameter:
315 self.dh_groups.add(name)
316 elif name.startswith('PSA_ALG_') and not parameter:
317 if name in ['PSA_ALG_ECDSA_BASE',
321 self.algorithms.add(name)
322 self.record_algorithm_subtype(name, expansion)
323 elif name.startswith('PSA_ALG_') and parameter == 'hash_alg':
324 self.algorithms_from_hash[name] = self.algorithm_tester(name)
325 elif name.startswith('PSA_KEY_USAGE_') and not parameter:
326 self.key_usage_flags.add(name)
448 # Groups: 1=macro name, 2=type, 3=argument list (optional).
461 # Auxiliary macro whose name doesn't fit the usual patterns for
470 name = m.group(1)
471 self.all_declared.add(name)
472 if re.search(self._excluded_name_re, name) or \
473 name in self._excluded_names or \
474 self.is_internal_name(name):
479 dest.add(name)
481 self.argspecs[name] = self._argument_split(m.group(3))
493 for name in re.findall(self._macro_identifier_re, expr):
494 if name not in self.all_declared:
495 yield name