Michael Bell wrote:

I think this is the relevant code (OpenSSL.xs):

int
serial(cert)
        OpenCA_OpenSSL_X509 cert
    PREINIT:
        char * stringval;
    CODE:
        stringval = i2s_ASN1_INTEGER(NULL,X509_get_serialNumber(cert));
        RETVAL = atoi(stringval);
        free(stringval);
    OUTPUT:
        RETVAL

int is usually not an 8 byte unsigned integer. Perhaps it is enough to change the return datatype to "unsigned long long int" and replace atoi with "strtoull (stringval, (char **)NULL, 10);"

Uups, this works only on 64-bit platforms. Please use the following. this should work on 32-bit platforms too.

char *
serial(cert)
        OpenCA_OpenSSL_X509 cert
    PREINIT:
        char * stringval;
    CODE:
        RETVAL = i2s_ASN1_INTEGER(NULL,X509_get_serialNumber(cert));
    OUTPUT:
        RETVAL

Actually my automatic tests are failing with this. So perhaps it is not perfect.

Michael
--
_______________________________________________________________

Michael Bell                    Humboldt-Universitaet zu Berlin

Tel.: +49 (0)30-2093 2482       ZE Computer- und Medienservice
Fax:  +49 (0)30-2093 2704       Unter den Linden 6
[EMAIL PROTECTED]   D-10099 Berlin
_______________________________________________________________

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Reply via email to