Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS: current master fails to compile #1768

Closed
mouse07410 opened this issue Aug 20, 2019 · 0 comments
Closed

MacOS: current master fails to compile #1768

mouse07410 opened this issue Aug 20, 2019 · 0 comments

Comments

@mouse07410
Copy link
Contributor

mouse07410 commented Aug 20, 2019

Problem Description

Merging last commits introduced pointer incompatibility call sc_format_apdu_ex() with wrong arguments in src/libopensc/card-mcrd.c, which fails to compile with the default -Werror switch.

Specifically, sc_format_apdu_ex() does not have an input parameter of type sc_card_t, it's first parameter is of type struct sc_apdu *.

Proposed Resolution

Call sc_format_apdu_ex() with the correct arguments in src/libopensc/card-mcrd.c.
Looks like it needs ..., cla, ins, p1, p2, ... - and one of these four is missing from the list of arguments.

Steps to reproduce

Configure, compile, observe the output

Logs

libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../.. -DOPENSC_CONF_PATH=\"/Library/OpenSC/etc/opensc.conf\" -DDEFAULT_SM_MODULE_PATH=\"/Library/OpenSC/lib\" -DDEFAULT_SM_MODULE=\"libsmm-local.so\" -I../../src -I/opt/local/include -I/opt/local/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/PCSC.framework/Versions/Current/Headers -march=native -Os -Ofast -std=gnu17 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -arch x86_64 -Wall -Wextra -Wno-unused-parameter -Werror -c card-mcrd.c  -fno-common -DPIC -o .libs/libopensc_la-card-mcrd.o
card-mcrd.c:199:20: error: incompatible pointer types passing 'sc_card_t *' (aka 'struct sc_card *') to parameter of
      type 'struct sc_apdu *' [-Werror,-Wincompatible-pointer-types]
        sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xA4, sbuf, 2, NULL, 0);
                          ^~~~
../../src/libopensc/opensc.h:824:40: note: passing argument to parameter 'apdu' here
void sc_format_apdu_ex(struct sc_apdu *apdu,
                                       ^
card-mcrd.c:199:26: error: incompatible pointer to integer conversion passing 'sc_apdu_t *' (aka 'struct sc_apdu *') to
      parameter of type 'u8' (aka 'unsigned char') [-Werror,-Wint-conversion]
        sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xA4, sbuf, 2, NULL, 0);
                                ^~~~~
../../src/libopensc/opensc.h:825:6: note: passing argument to parameter 'cla' here
                u8 cla, u8 ins, u8 p1, u8 p2,
                   ^
card-mcrd.c:212:20: error: incompatible pointer types passing 'sc_card_t *' (aka 'struct sc_card *') to parameter of
      type 'struct sc_apdu *' [-Werror,-Wincompatible-pointer-types]
        sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB6, sbuf, 2, NULL, 0);
                          ^~~~
../../src/libopensc/opensc.h:824:40: note: passing argument to parameter 'apdu' here
void sc_format_apdu_ex(struct sc_apdu *apdu,
                                       ^
card-mcrd.c:212:26: error: incompatible pointer to integer conversion passing 'sc_apdu_t *' (aka 'struct sc_apdu *') to
      parameter of type 'u8' (aka 'unsigned char') [-Werror,-Wint-conversion]
        sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB6, sbuf, 2, NULL, 0);
                                ^~~~~
../../src/libopensc/opensc.h:825:6: note: passing argument to parameter 'cla' here
                u8 cla, u8 ins, u8 p1, u8 p2,
                   ^
card-mcrd.c:1026:21: error: incompatible pointer types passing 'sc_card_t *' (aka 'struct sc_card *') to parameter of
      type 'struct sc_apdu *' [-Werror,-Wincompatible-pointer-types]
                sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB8, sbuf, 5, NULL, 0);
                                  ^~~~
../../src/libopensc/opensc.h:824:40: note: passing argument to parameter 'apdu' here
void sc_format_apdu_ex(struct sc_apdu *apdu,
                                       ^
card-mcrd.c:1026:27: error: incompatible pointer to integer conversion passing 'sc_apdu_t *' (aka 'struct sc_apdu *')
      to parameter of type 'u8' (aka 'unsigned char') [-Werror,-Wint-conversion]
                sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB8, sbuf, 5, NULL, 0);
                                        ^~~~~
../../src/libopensc/opensc.h:825:6: note: passing argument to parameter 'cla' here
                u8 cla, u8 ins, u8 p1, u8 p2,
                   ^
card-mcrd.c:1029:21: error: incompatible pointer types passing 'sc_card_t *' (aka 'struct sc_card *') to parameter of
      type 'struct sc_apdu *' [-Werror,-Wincompatible-pointer-types]
                sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB6, sbuf, 5, NULL, 0);
                                  ^~~~
../../src/libopensc/opensc.h:824:40: note: passing argument to parameter 'apdu' here
void sc_format_apdu_ex(struct sc_apdu *apdu,
                                       ^
card-mcrd.c:1029:27: error: incompatible pointer to integer conversion passing 'sc_apdu_t *' (aka 'struct sc_apdu *')
      to parameter of type 'u8' (aka 'unsigned char') [-Werror,-Wint-conversion]
                sc_format_apdu_ex(card, &apdu, 0x22, 0x41, 0xB6, sbuf, 5, NULL, 0);
                                        ^~~~~
../../src/libopensc/opensc.h:825:6: note: passing argument to parameter 'cla' here
                u8 cla, u8 ins, u8 p1, u8 p2,
                   ^
8 errors generated.

Update

Merely removing the first argument card from the calls to sc_format_apdu_ex() does not help, as then it's one input argument short. Work is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant