Skip to content

Conversation

@commodo
Copy link
Contributor

@commodo commodo commented Oct 27, 2021

This follows update https://bugs.python.org/issue43669

Which is present in Python 3.10

Some OpenSSL 1.1.1 can be built without Blake2 support or Scrypt.

SHA3 and SHAKE do not seem to have any enable/disable flags.

This results in compiler errors where EVP_blake2b512, EVP_blake2s256,
EVP_PBE_scrypt and PKCS5_v2_scrypt_keyivgen can be un-defined.

This is unfortunate behavior on the part of OpenSSL 1.1.1.

So, for BLAKE2 and SCRYPT, we should still check that the OPENSSL_NO_SCRYPT
and OPENSSL_NO_BLAKE2 defines are not-define.

Looking into the evp.h header of OpenSSL 1.1.1l, we get:

 .........
 # ifndef OPENSSL_NO_BLAKE2
 const EVP_MD *EVP_blake2b512(void);
 const EVP_MD *EVP_blake2s256(void);
 # endif
 .........
 #ifndef OPENSSL_NO_SCRYPT
 int EVP_PBE_scrypt(const char *pass, size_t passlen,
                    const unsigned char *salt, size_t saltlen,
                    uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
                    unsigned char *key, size_t keylen);

 int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
                              int passlen, ASN1_TYPE *param,
                              const EVP_CIPHER *c, const EVP_MD *md, int en_de);
 #endif
 .........

Signed-off-by: Alexandru Ardelean ardeleanalex@gmail.com

https://bugs.python.org/issue45627

…29237)

This follows update https://bugs.python.org/issue43669

Which is present in Python 3.10

Some OpenSSL 1.1.1 can be built without Blake2 support or Scrypt.

SHA3 and SHAKE do not seem to have any enable/disable flags.

This results in compiler errors where EVP_blake2b512, EVP_blake2s256,
EVP_PBE_scrypt and PKCS5_v2_scrypt_keyivgen can be un-defined.

This is unfortunate behavior on the part of OpenSSL 1.1.1.

So, for BLAKE2 and SCRYPT, we should still check that the OPENSSL_NO_SCRYPT
and OPENSSL_NO_BLAKE2 defines are not-define.

Looking into the evp.h header of OpenSSL 1.1.1l, we get:

```
 .........
 # ifndef OPENSSL_NO_BLAKE2
 const EVP_MD *EVP_blake2b512(void);
 const EVP_MD *EVP_blake2s256(void);
 # endif
 .........
 #ifndef OPENSSL_NO_SCRYPT
 int EVP_PBE_scrypt(const char *pass, size_t passlen,
                    const unsigned char *salt, size_t saltlen,
                    uint64_t N, uint64_t r, uint64_t p, uint64_t maxmem,
                    unsigned char *key, size_t keylen);

 int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
                              int passlen, ASN1_TYPE *param,
                              const EVP_CIPHER *c, const EVP_MD *md, int en_de);
 #endif
 .........
```

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
@commodo commodo changed the title bpo-45627: handle OPENSSL_NO_SCRYPT and OPENSSL_NO_BLAKE defines bpo-45627: handle OPENSSL_NO_SCRYPT and OPENSSL_NO_BLAKE defines (GH-29237) Oct 27, 2021
@commodo
Copy link
Contributor Author

commodo commented Oct 27, 2021

oh ; so blurb is still required;

will submit one

@commodo
Copy link
Contributor Author

commodo commented Oct 28, 2021

Closing this in light of
https://www.python.org/dev/peps/pep-0644/#compatibility

@commodo commodo closed this Oct 28, 2021
@commodo commodo deleted the hashlib-disable-flags branch October 28, 2021 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants