[OpenSSL-1.0.2] TNF local patch - cleanup all testcase

Issue #177 resolved
Takehiko NOZAKI repo owner created an issue

original commit message: TBD

Comments (3)

  1. Takehiko NOZAKI reporter

    some diffs completely broken, for example:

    diff --exclude=CVS -upNr openssl-1.0.2k/crypto/ripemd/rmdtest.c src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmdtest.c
    --- openssl-1.0.2k/crypto/ripemd/rmdtest.c      2017-01-26 22:22:03.000000000 +0900
    +++ src/crypto/external/bsd/openssl/dist/crypto/ripemd/rmdtest.c        2015-03-23 19:22:48.000000000 +0900
    @@ -76,7 +76,7 @@ int main(int argc, char *argv[])
     #  include <openssl/ebcdic.h>
     # endif
    
    -static char *test[] = {
    +static const char *test[] = {
         "",
         "a",
         "abc",
    @@ -88,7 +88,7 @@ static char *test[] = {
         NULL,
     };
    
    -static char *ret[] = {
    +static const char *ret[] = {
         "9c1185a5c5e9fc54612808977ee8f548b2258d31",
         "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe",
         "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
    @@ -103,7 +103,7 @@ static char *pt(unsigned char *md);
     int main(int argc, char *argv[])
     {
         int i, err = 0;
    -    char **P, **R;
    +    const char **P, **R;
         char *p;
         unsigned char md[RIPEMD160_DIGEST_LENGTH];
    
    @@ -112,12 +112,12 @@ int main(int argc, char *argv[])
         i = 1;
         while (*P != NULL) {
     # ifdef CHARSET_EBCDIC
    -        ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P));
    +        ebcdic2ascii((const char *)*P, (char *)*P, strlen((char *)*P));
     # endif
    -        EVP_Digest(&(P[0][0]), strlen((char *)*P), md, NULL, EVP_ripemd160(),
    +        EVP_Digest(&(P[0][0]), strlen((const char *)*P), md, NULL, EVP_ripemd160(),
                        NULL);
             p = pt(md);
    -        if (strcmp(p, (char *)*R) != 0) {
    +        if (strcmp(p, (const char *)*R) != 0) {
                 printf("error calculating RIPEMD160 on '%s'\n", *P);
                 printf("got %s instead of %s\n", p, *R);
                 err++;
    

    this patch make ``test'' string array as const to erase following error:

    error: initialization discards qualifiers from pointer target type
    

    but ebcdic2ascii() rewrite the string of test pointed by P, so const-fy test causes fatal error.

    so using -Wno-write-strings is the correct fix:

    diff --git a/tests/crypto/libcrypto/ripemd/Makefile b/tests/crypto/libcrypto/ripemd/Makefile
    index dd55aa90a7..f219f3a9d4 100644
    --- a/tests/crypto/libcrypto/ripemd/Makefile
    +++ b/tests/crypto/libcrypto/ripemd/Makefile
    @@ -3,5 +3,6 @@
     HELPER_NAME=   ripemdtest
     HELPER_DIR=    ripemd
     HELPER_SRCS=   rmdtest.c
    +COPTS.${HELPER_NAME}.c+=-Wno-write-strings
    
     .include <bsd.init.mk>
    
  2. Log in to comment