Hello,
On Thu, Sep 10, 2009 at 08:34:56AM +0200, Einar Thorsrud wrote:
> > I do not find any possibility to add the label to the
> > RSA_public_encrypt() function, but it could perhaps be achieved
> > otherwise?
>
> Could the label perhaps be related to the *p parameter in
>
> int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
> const unsigned char *f,int fl,
> const unsigned char *p,int pl);
>
> This however, is really just a shot in the dark on my behalf,
> as I am unable to find any reference to "label" related to RSA
> in the OpenSSL source code.
I've just had a quick look at the code and to me it seems like you're
right.
The PKCS#1 v2.1 document says on page 18, 2a and 2c that for applying
the OEAP padding, the label is used as input to a hash function. The
function's output is concatenated with other data in DB,
DB = lhash||ps||0x01||m
I would say this is what happens in RSA_padding_add_PKCS1_OAEP()
(p is called param in my version):
EVP_Digest((void *)param, plen, db, NULL, EVP_sha1(), NULL);
(digest function's output is db, its length is SHA_DIGEST_LENGTH)
the following line clears the remaining part of db that is filled later
as described above.
memset(db + SHA_DIGEST_LENGTH, 0, emlen - flen - 2 * SHA_DIGEST_LENGTH - 1);
Best regards,
Martin
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]