Skip to content

Move basic AES ciphers into the default provider#8700

Closed
mattcaswell wants to merge 18 commits intoopenssl:masterfrom
mattcaswell:provider-cipher
Closed

Move basic AES ciphers into the default provider#8700
mattcaswell wants to merge 18 commits intoopenssl:masterfrom
mattcaswell:provider-cipher

Conversation

@mattcaswell
Copy link
Member

This moves basic AES ciphers: ECB, CBC, OFB, CFB, CFB1, CFB8 and CTR, of all key sizes into the default provider.

Marked as WIP because there's a bunch of sparc and s390 specific code which still requires some attention. Also it depends on a bug fix commit from #8541.

@mattcaswell mattcaswell added the branch: master Applies to master branch label Apr 8, 2019
Copy link
Member

@levitte levitte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First quick read

@mattcaswell
Copy link
Member Author

Rebased and updated commits pushed. All comments above are either fixed or responded to.

@mattcaswell
Copy link
Member Author

I've rebased this to address merge conflicts with master and have also made a couple of tweaks to address travis failures.

@mattcaswell
Copy link
Member Author

Hmmm, travis doesn't like this code:

int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad)
{
    if (pad)
        ctx->flags &= ~EVP_CIPH_NO_PADDING;
    else
        ctx->flags |= EVP_CIPH_NO_PADDING;

    if (ctx->cipher != NULL && ctx->cipher->prov != NULL) {
        const OSSL_PARAM params[] = {
            OSSL_PARAM_int(OSSL_CIPHER_PARAM_PADDING, &pad),
            OSSL_PARAM_END
        };

Complains with:

crypto/evp/evp_enc.c: In function 'EVP_CIPHER_CTX_set_padding':
crypto/evp/evp_enc.c:904:35: error: initializer element is not computable at load time [-Werror=pedantic]
             OSSL_PARAM_int(OSSL_CIPHER_PARAM_PADDING, &pad),
                                   ^

Isn't that how I'm supposed to use OSSL_PARAM_int? If we can't do that then the usefulness of those macros is significantly reduced.

@mattcaswell
Copy link
Member Author

Work arounds/fixes for a couple more travis issues pushed.

@paulidale
Copy link
Contributor

Unless the params array is static as are all the variables referenced, at least one of the CI compilers will complain. Try this instead:

OSSL_PARAM params[2];

params[0] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_PADDING, &pad, NULL);
params[1] = OSSL_PARAM_construct_end();

Unfortunately, the static const OSSL_PARAM array construction is likely to be lightly used because it isn’t thread safe.

@mattcaswell
Copy link
Member Author

Pushed. Thanks!

levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
We also lay the ground work for various of other the basic AES ciphers.

Reviewed-by: Paul Dale <[email protected]>
(Merged from #8700)
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
levitte pushed a commit that referenced this pull request Apr 19, 2019
Reviewed-by: Paul Dale <[email protected]>
(Merged from #8700)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants