On Wed, 29 Aug 2001 15:19:24 +0200 (MET DST), Peter Sylvester wrote:

>would it be possible to add something like the following
>to evp/evp_test.c  It is not a replacement for strsep but
>a function that seems to work with the few calls in evp_test.c
>
>
>static char * strsep(char **p,const char *sep) {
>       char * p1 = *p ;
>       while (**p != *sep) {
>               if (**p == '\0') return p1;
>               (*p)++;
>       } 
>       **p = '\0'; (*p)++ ;
>       return p1 ;
>}


I went a little further & wrote a full strsep() (wasn't hard). Not heavily
tested but seems to work ok. After adding this to evp_test.c & getting it
to build, it fails on the AES test. Is this a known problem or should I
pursue it further? The output is

Testing cipher AES-128-ECB
Key
0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Plaintext
0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Ciphertext
0000 c3 4c 05 2c c0 da 8d 73 45 1a fe 5f 03 be 29 7f
Ciphertext mismatch
Got
0000 66 e9 4b d4 ef 8a 2c 3b 88 4c fa 59 ca 34 2b 2e
Expected
0000 c3 4c 05 2c c0 da 8d 73 45 1a fe 5f 03 be 29 7f


If I comment out the AES test, the rest all pass.
Anyway, here's my strsep(). Not in the EAY style as just reading the stuff
makes my head hurt, writing it would make me vomit, & I can't convince
indent to create it (indent --uglify perhaps?)



char *strsep(char **string, const char *delim)
{
    char isdelim[256];
    char *token = *string;

    if (**string == 0)
        return NULL;

    memset(isdelim, 0, 256);
    isdelim[0] = 1;

    while (*delim) {
        isdelim[(unsigned char)(*delim)] = 1;
        delim++;
    }

    while (!isdelim[(unsigned char)(**string)]) {
        (*string)++;
    }

    if (**string) {
        **string = 0;
        (*string)++;
    }

    return token;
}

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  [EMAIL PROTECTED]  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to