Skip to content

d2i_ECPKParameters_fp throws lots of warnings #12443

@bbbrumley

Description

@bbbrumley

I think some of these macros are stale. Below is master but I get the same warnings in 1.1.1, although the code seems to runs fine.

MWE:

#include <openssl/ec.h>
#include <assert.h>

int main(int argc, char **argv) {
    EC_GROUP *group = NULL;
    FILE *fp = NULL;

    assert((fp = fopen("params.der", "rb")) != NULL);
    assert((group = d2i_ECPKParameters_fp(fp, NULL)) != NULL);
    fclose(fp);
    EC_GROUP_free(group);

    return 0;
}
bbrumley@arizona:/tmp$ rm foo; cc -o foo foo.c -lcrypto -L$HOME/.local/ssl/lib -I$HOME/.local/ssl/include
In file included from foo.c:2:0:
foo.c: In function ‘main’:
/home/bbrumley/.local/ssl/include/openssl/ec.h:841:35: warning: passing argument 2 of ‘ASN1_d2i_fp’ from incompatible pointer type [-Wincompatible-pointer-types]
     (EC_GROUP *)ASN1_d2i_fp(NULL, (char *(*)())d2i_ECPKParameters, (fp), \
                                   ^
foo.c:9:21: note: in expansion of macro ‘d2i_ECPKParameters_fp’
     assert((group = d2i_ECPKParameters_fp(fp, NULL)) != NULL);
                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/bbrumley/.local/ssl/include/openssl/ec.h:23:0,
                 from foo.c:1:
/home/bbrumley/.local/ssl/include/openssl/asn1.h:689:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
 void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
       ^~~~~~~~~~~
In file included from foo.c:2:0:
/home/bbrumley/.local/ssl/include/openssl/ec.h:842:29: warning: passing argument 4 of ‘ASN1_d2i_fp’ from incompatible pointer type [-Wincompatible-pointer-types]
                             (unsigned char **)(x))
                             ^
foo.c:9:21: note: in expansion of macro ‘d2i_ECPKParameters_fp’
     assert((group = d2i_ECPKParameters_fp(fp, NULL)) != NULL);
                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/bbrumley/.local/ssl/include/openssl/ec.h:23:0,
                 from foo.c:1:
/home/bbrumley/.local/ssl/include/openssl/asn1.h:689:7: note: expected ‘void **’ but argument is of type ‘unsigned char **’
 void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
       ^~~~~~~~~~~
In file included from foo.c:2:0:
/home/bbrumley/.local/ssl/include/openssl/ec.h:841:35: warning: passing argument 2 of ‘ASN1_d2i_fp’ from incompatible pointer type [-Wincompatible-pointer-types]
     (EC_GROUP *)ASN1_d2i_fp(NULL, (char *(*)())d2i_ECPKParameters, (fp), \
                                   ^
foo.c:9:21: note: in expansion of macro ‘d2i_ECPKParameters_fp’
     assert((group = d2i_ECPKParameters_fp(fp, NULL)) != NULL);
                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/bbrumley/.local/ssl/include/openssl/ec.h:23:0,
                 from foo.c:1:
/home/bbrumley/.local/ssl/include/openssl/asn1.h:689:7: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
 void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
       ^~~~~~~~~~~
In file included from foo.c:2:0:
/home/bbrumley/.local/ssl/include/openssl/ec.h:842:29: warning: passing argument 4 of ‘ASN1_d2i_fp’ from incompatible pointer type [-Wincompatible-pointer-types]
                             (unsigned char **)(x))
                             ^
foo.c:9:21: note: in expansion of macro ‘d2i_ECPKParameters_fp’
     assert((group = d2i_ECPKParameters_fp(fp, NULL)) != NULL);
                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/bbrumley/.local/ssl/include/openssl/ec.h:23:0,
                 from foo.c:1:
/home/bbrumley/.local/ssl/include/openssl/asn1.h:689:7: note: expected ‘void **’ but argument is of type ‘unsigned char **’
 void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
       ^~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    branch: 1.1.1Applies to OpenSSL_1_1_1-stable branch (EOL)branch: masterApplies to master branchtriaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions