(name)
| 124 | |
| 125 | |
| 126 | def __get_openssl_constructor(name): |
| 127 | if name in __block_openssl_constructor: |
| 128 | # Prefer our builtin blake2 implementation. |
| 129 | return __get_builtin_constructor(name) |
| 130 | try: |
| 131 | # MD5, SHA1, and SHA2 are in all supported OpenSSL versions |
| 132 | # SHA3/shake are available in OpenSSL 1.1.1+ |
| 133 | f = getattr(_hashlib, 'openssl_' + name) |
| 134 | # Allow the C module to raise ValueError. The function will be |
| 135 | # defined but the hash not actually available. Don't fall back to |
| 136 | # builtin if the current security policy blocks a digest, bpo#40695. |
| 137 | f(usedforsecurity=False) |
| 138 | # Use the C function directly (very fast) |
| 139 | return f |
| 140 | except (AttributeError, ValueError): |
| 141 | return __get_builtin_constructor(name) |
| 142 | |
| 143 | |
| 144 | def __py_new(name, *args, **kwargs): |
nothing calls this directly
no test coverage detected