Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340080 > unrolled thread

Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer

Started byTadeusz Struk <tadeusz.struk@intel.com>
First post2016-02-23 00:40 +0100
Last post2016-02-24 18:30 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto  layer Tadeusz Struk <tadeusz.struk@intel.com> - 2016-02-23 00:40 +0100
    Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer David Howells <dhowells@redhat.com> - 2016-02-23 12:00 +0100
      [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey Tadeusz Struk <tadeusz.struk@intel.com> - 2016-02-24 18:20 +0100
        Re: [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey David Howells <dhowells@redhat.com> - 2016-02-24 18:30 +0100

#1340080 — Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer

FromTadeusz Struk <tadeusz.struk@intel.com>
Date2016-02-23 00:40 +0100
SubjectRe: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer
Message-ID<r58f8-55M-5@gated-at.bofh.it>
On 02/22/2016 02:28 PM, David Howells wrote:
> Tadeusz Struk <tadeusz.struk@intel.com> wrote:
> 
>> I wonder if this should be merged with the crypto/rsa-pkcs1pad.c template
>> that we already have. Looks like the two do the same padding now.
>> Should we merge then and pass the hash param as a separate template param,
>> e.g the public_key would allocate "pkcs1pad(rsa, sha1)"?
> 
> Ummm...  Possibly.  Is that how it's used?
> 
> 	warthog>git grep pkcs1pad -- Documentation
> 	warthog1>

Yes, no docs. Sorry.

> 
> Anyway, the problem I have with this is that I want to get that knowledge out
> of the asymmetric key in-software public key subtype.  It knows "rsa", "dsa",
> "ecdsa", ... because that's all the OIDs tell it.

Rigth, for now the public_key would need to build the full algorithm string as
follows:

vsprintf(name, "pkcs1pad(%s, %s)", pkey_algo_name[sig->pkey_algo],
         hash_algo_name[sig->pkey_hash_algo]);

Do you plan to add more padding schemes later? 

> 
> I guess if I have to, I can stoop to converting "rsa" to "pkcs1pad(rsa, sha1)".
> 
> Can you do me a really quick merge?  -rc5 is already out, and I want to get it
> to James pronto - plus I have things that are pending on this change being
> made.

Yes, I can start woring on a subsequent patch based on your changes in
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-rsa
Is that ok with you?

> 
> Oh - and how does the padding template find the algorithm DER encoding string
> to use?  I have wondered whether it should be stored in with the hash
> algorithm, but it probably makes more sense to keep it with the rsa module.

We can put everything into the crypto/rsa-pkcs1pad.c
This is where all the padding logic should be, I think.
Thanks,
-- 
TS

[toc] | [next] | [standalone]


#1340541 — Re: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer

FromDavid Howells <dhowells@redhat.com>
Date2016-02-23 12:00 +0100
SubjectRe: [PATCH 4/8] akcipher: Move the RSA DER encoding to the crypto layer
Message-ID<r5iRe-45N-41@gated-at.bofh.it>
In reply to#1340080
Tadeusz Struk <tadeusz.struk@intel.com> wrote:

> > Ummm...  Possibly.  Is that how it's used?
> > 
> > 	warthog>git grep pkcs1pad -- Documentation
> > 	warthog1>
> 
> Yes, no docs. Sorry.

Can I suggest you at least stick a quick usage summary in the banner comment
at the top of the file?

> > Anyway, the problem I have with this is that I want to get that knowledge
> > out of the asymmetric key in-software public key subtype.  It knows "rsa",
> > "dsa", "ecdsa", ... because that's all the OIDs tell it.
> 
> Rigth, for now the public_key would need to build the full algorithm string as
> follows:
> 
> vsprintf(name, "pkcs1pad(%s, %s)", pkey_algo_name[sig->pkey_algo],
>          hash_algo_name[sig->pkey_hash_algo]);

Does this apply to anything other than RSA?

> Do you plan to add more padding schemes later? 

No plans to, but one never knows.  I'm *assuming* that OID_rsaEncryption and
OID_sha256WithRSAEncryption, for example, must implicitly specify the padding
scheme (RFC4055 suggests I'm right in this assumption).

We might have to suppose RSASSA-SSP at some point.

> Yes, I can start woring on a subsequent patch based on your changes in
> http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-rsa
> Is that ok with you?

Sure.

David

[toc] | [prev] | [next] | [standalone]


#1342239 — [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey

FromTadeusz Struk <tadeusz.struk@intel.com>
Date2016-02-24 18:20 +0100
Subject[PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey
Message-ID<r5Lgu-7GJ-5@gated-at.bofh.it>
In reply to#1340541
Hi David,
I have converted the software_pkey to make use of the pkcs1pad
template. The rsa.c is reverted back to what it was i.e. just
math primitives and all padding is done in rsa-pkcs1padd.c
software_pkey.c just allocates pksc1padd(alg,hash)

This is incremental series on top of the current
http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-rsa

---

Tadeusz Struk (2):
      crypto: Add hash param to pkcs1pad
      crypto: remove paddings logic from rsa.c


 crypto/asymmetric_keys/software_pkey.c |   28 ++++
 crypto/rsa-pkcs1pad.c                  |  182 ++++++++++++++++++++++++----
 crypto/rsa.c                           |  210 +++++---------------------------
 crypto/testmgr.c                       |    5 -
 include/crypto/akcipher.h              |    7 -
 5 files changed, 212 insertions(+), 220 deletions(-)

--

[toc] | [prev] | [next] | [standalone]


#1342250 — Re: [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey

FromDavid Howells <dhowells@redhat.com>
Date2016-02-24 18:30 +0100
SubjectRe: [PATCH 0/2] KEYS: Use pkcs1pad for padding in software_pkey
Message-ID<r5Lqc-7M2-37@gated-at.bofh.it>
In reply to#1342239
Tadeusz Struk <tadeusz.struk@intel.com> wrote:

> I have converted the software_pkey to make use of the pkcs1pad
> template. The rsa.c is reverted back to what it was i.e. just
> math primitives and all padding is done in rsa-pkcs1padd.c
> software_pkey.c just allocates pksc1padd(alg,hash)

Okay, thanks - I'll take a look at that later.

One thought that just occurred to me: would it make sense to make a second
crypto template in rsa-pkcs1pad.c and call it "rsassa-pkcs1-v1_5" that does
this padding variant?  It can share most of its code with the generic pkcs1pad
algorithm.

We could then also add a third variant "rsassa-pss" at a later date.

David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web