Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: RE : Re: RE : C / external procedure puzzle for the C guru's
Thanks, I'll give that a try.
Won't be able to get to it till tonight; will let you know tomorrow.
Jared
On Wed, 31 May 2000, Stephane Faroult wrote:
> > 06525, 00000, "Length Mismatch for CHAR or RAW data"
> > // *Cause: The length specified in the length variable has an illegal
> > // value. This can happen if you have requested requested a PL/SQL
> > // INOUT, OUT or RETURN raw variable to be passed as a RAW with
> > // no corresponding length variable. This error can also happen
> > // if there is a mismatch in the length value set in the length
> > // variable and the length in the orlvstr or orlraw.
> > //
> > // *Action: Correct the external procedure code and set the length variable
> > // correctly.
> > //
> >
> >
> > What is a 'length variable'?
>
> Would see what it would be with OCI, but I don't know how PL/SQL is
> coded ... I presume that 'somewhere' the RAW is expected to be passed as
> length + array ... Your best bet is probably to modify the rc4()
> function and to make it an unsigned char *rc4() instead of a void *rc4()
> and to code it as follows :
>
> unsigned char *rc4(unsigned char *buffer_ptr, int buffer_len, rc4_key
> *key)
> {
> static unsigned char crypt_buffer[1024];
> unsigned char hexa[3];
> unsigned char x;
> unsigned char y;
> unsigned char* state;
> unsigned char xorIndex;
> short counter;
>
> x = key->x;
> y = key->y;
>
> state = &key->state[0];
> crypt_buffer[0] = '\0';
> for(counter = 0; counter < buffer_len; counter ++)
> {
> x = (x + 1) % 256;
> y = (state[x] + y) % 256;
> swap_byte(&state[x], &state[y]);
>
> xorIndex = (state[x] + state[y]) % 256;
>
> sprintf(hexa, "%02X", buffer_ptr[counter] ^
> state[xorIndex]);
> strcat(crypt_buffer, hexa);
> }
> key->x = x;
> key->y = y;
> return(crypt_buffer);
> }
>
> In other words, keeping the string to crypt intact but returning the
> crypted string as a hexadecimal string. I think that, if you still
> define your function to return a RAW, it should work in this case
> (hopefully).
> --
> Regards,
>
> Stephane Faroult
> email: sfaroult_at_oriolecorp.com
> Oriole Corporation
> Voice: +44 (0) 7050-696-269
> Fax: +44 (0) 7050-696-449
> Performance Tools & Free Scripts
> ------------------------------------------------------------------
> http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs
> ------------------------------------------------------------------
>
Jared Still
Certified Oracle DBA and Part Time Perl Evangelist ;-)
Regence BlueCross BlueShield of Oregon
Received on Wed May 31 2000 - 11:12:32 CDT
![]() |
![]() |