Re: [PATCH] RSA: Don't select non-existent symbol

2014-05-30 Thread David Howells
Jean Delvare wrote: > > This patch should go to David Howells > > Why? How could I find out? Try "git log". David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo

Making the asymmetric keys config option into a top-level option

2014-07-17 Thread David Howells
Dmitry Kasatkin wrote: > When ASYMMETRIC_KEYS=y, but depends on CRYPTO=m, selections will be also > modules. > In random config case OID_REGISTRY, MPILIB and ASN1 became modules producing > build > break. This patch removes asymmetric keys dependency from CRYPTO, but instead > selects CRYPTO an

Re: [PATCH 2/2] digsig: make crypto builtin if digsig selected as builtin

2014-07-17 Thread David Howells
Dmitry Kasatkin wrote: > When SIGNATURE=y but depends on CRYPTO=m, it selects MPILIB as module > producing build break. This patch makes digsig to select crypto for > correcting dependency. I'll apply this one. David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in

[GIT PULL] Keyrings and asymmetric keys patches for 3.17

2014-07-17 Thread David Howells
ion for keys-next local branch) Keyrings for linux-next Keyrings patches ---- David Howells (34): X.509: Add bits needed for PKCS#7 X.509: Export certificate parse and free functions KEYS: Provide a generic instantiation function KEYS: struct key_preparsed_payload should have two p

Re: [GIT PULL] Keyrings and asymmetric keys patches for 3.17

2014-07-18 Thread David Howells
Stephen Rothwell wrote: > I hate to be a pest, but this whole branch has only your signed off by > and no indication that any of it has been reviewed/tested by anyone > else ... Okay, I've got at least one review for most of the patches. I'll try and get some more, but it probably won't be till

[GIT PULL] Keyrings and asymmetric keys patches for 3.17

2014-07-22 Thread David Howells
#x27;keys-fixes' into keys-next (2014-07-22 21:55:45 +0100) (from the branch description for keys-next local branch) Keyrings for linux-next Keyrings patches -------- David Ho

[GIT PULL] Keyrings: PKCS#7 fixup

2014-07-25 Thread David Howells
from the branch description for keys-next local branch) Keyrings for linux-next Keyrings patches -------- David Howells (1): PKCS#7: Missing inclusion of linux/err.h crypto/asymmetric_keys/pkcs7_key_type.c | 1 + 1 file changed, 1 ins

Re: [PATCH -next] PKCS#7: fix sparse non static symbol warning

2014-07-28 Thread David Howells
weiyj...@163.com wrote: > From: Wei Yongjun > > Fixes the following sparse warnings: > > crypto/asymmetric_keys/pkcs7_key_type.c:73:17: warning: > symbol 'key_type_pkcs7' was not declared. Should it be static? > > Signed-off-by: Wei Yongjun Applied. -- To unsubscribe from this list: send th

Re: PKCS#7: Verify internal certificate chain

2014-07-31 Thread David Howells
Dan Carpenter wrote: >193if (x509->issuer) > > Check. > >194pr_debug("- issuer %s\n", x509->issuer); Actually, x509->subject and x509->issuer are mandatory in the ASN.1 definition and point

Re: [PATCH] MPILIB: avoid assembler warning

2015-01-28 Thread David Howells
Arnd Bergmann wrote: > Not sure who would be the best person to pick this patch up. I can pick it up, but I wonder if the MPI asm bits should be distributed to asm/mpilib.h headers rather than being in the lib/ directory. David -- To unsubscribe from this list: send the line "unsubscribe linux-

[PATCH 2/2] crypto: Wrap the LHS in expressions of the form !x == y

2015-04-28 Thread David Howells
comparison [-Wlogical-not-parentheses] if (!ret == template[i].fail) { ^ By converting the 'fail' member of struct aead_testvec and struct cipher_testvec to a bool, we can get rid of the warnings. Signed-off-by: David Howells --- crypto/testmgr.h |6 +++--- 1 file c

[PATCH 1/2] crypto: Constify (de)compression parameters

2015-04-28 Thread David Howells
ing: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers] .params = &deflate_decomp_params, ^ Fix this by making the parameters pointer const and constifying the things that use it. Signed-off-by: David Howells --- cry

[PATCH 1/2] X.509: Fix double free in x509_cert_parse() [ver #3]

2016-11-24 Thread David Howells
0x199/0x2a0 [] entry_SYSCALL_64_fastpath+0x1e/0xad Fixes: db6c43bd2132 ("crypto: KEYS: convert public key and digsig asym to the akcipher api") Signed-off-by: Andrey Ryabinin Cc: Signed-off-by: David Howells --- crypto/asymmetric_keys/x509_cert_parser.c |1 - 1 file changed

[PATCH 2/2] mpi: Fix NULL ptr dereference in mpi_powm() [ver #3]

2016-11-24 Thread David Howells
atch;h=6e1adb05d290aeeb1c230c763970695f4a538526 Fixes: cdec9cb5167a ("crypto: GnuPG based MPI lib - source files (part 1)") Signed-off-by: Andrey Ryabinin Signed-off-by: David Howells cc: Dmitry Kasatkin cc: linux-ima-de...@lists.sourceforge.net cc: sta...@vger.kernel.org --- lib/mpi/mpi-pow.c |7 ++-

[PATCH 0/2] KEYS: Fixes [ver #3]

2016-11-24 Thread David Howells
Hi James, Can you pull these patches please and pass them on to Linus? They include the following: (1) Fix mpi_powm()'s handling of a number with a zero exponent [CVE-2016-8650]. (2) Fix double free in X.509 error handling. Ver #3: - Integrate my and Andrey's patches for mpi_powm() and us

Re: [PATCH 1/1] crypto: asymmetric_keys: set error code on failure

2016-12-12 Thread David Howells
Pan Bian wrote: > outlen = crypto_akcipher_maxsize(tfm); > output = kmalloc(outlen, GFP_KERNEL); > - if (!output) > + if (!output) { > + ret = -ENOMEM; > goto error_free_req; > + } This is preferred: + ret = -ENOMEM; outlen = crypt

Re: [PATCH] keys/encrypted: Fix two crypto-on-the-stack bugs

2016-12-12 Thread David Howells
Andy Lutomirski wrote: > +static const char zero_pad[16] = {0}; Isn't there a global page of zeros or something that we can share? Also, you shouldn't explicitly initialise it so that it stays in .bss. > - sg_set_buf(&sg_out[1], pad, sizeof pad); > + sg_set_buf(&sg_out[1], zero_pad, si

[PATCH 1/2] crypto: asymmetric_keys: set error code on failure

2016-12-13 Thread David Howells
-off-by: Pan Bian Signed-off-by: David Howells --- crypto/asymmetric_keys/public_key.c |1 + 1 file changed, 1 insertion(+) diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c index fd76b5fc3b3a..d3a989e718f5 100644 --- a/crypto/asymmetric_keys

[PATCH 2/2] sign-file: Fix inplace signing when src and dst names are both specified

2016-12-13 Thread David Howells
buf, sizeof(buf))), n > 0) { ERR(BIO_write(bd, buf, n) < 0, "%s", dest_name); } ... Signed-off-by: Alex Yashchenko Signed-off-by: David Howells --- scripts/sign-file.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scri

Re: [PATCH] keys/encrypted: Fix two crypto-on-the-stack bugs

2016-12-13 Thread David Howells
Andy Lutomirski wrote: > After all, rodata is ordinary memory, is backed by struct page, etc. Is that actually true? I thought some arches excluded the kernel image from the page struct array to make the array consume less memory. David -- To unsubscribe from this list: send the line "unsubscr

Re: [PATCH] keys/encrypted: Fix two crypto-on-the-stack bugs

2016-12-13 Thread David Howells
Andy Lutomirski wrote: > I don't know whether you're right, but that sounds a bit silly to me. > This is a *tiny* amount of memory. Assuming a 1MiB kernel image in 4K pages, that gets you back a couple of pages I think - useful if you've only got a few MiB of RAM. David -- To unsubscribe from t

Re: [PATCH v2] keys/encrypted: Fix two crypto-on-the-stack bugs

2016-12-14 Thread David Howells
Andy Lutomirski wrote: > > - sg_set_buf(&sg_out[1], pad, sizeof pad); > > + sg_set_buf(&sg_out[1], empty_zero_page, 16); > > My fix here is obviously bogus (I meant to use ZERO_PAGE(0)), but what > exactly is the code trying to do? The old code makes no sense. It's > setting the *o

Re: [PATCH v2] keys/encrypted: Fix two crypto-on-the-stack bugs

2016-12-14 Thread David Howells
Andy Lutomirski wrote: > David, are these encrypted keys ever exported anywhere? If not, could > the code use a mode that doesn't need padding? ecryptfs uses them, I think. David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vg

Re: [PATCH -next] crypto: asymmetric_keys - Fix error return code on failure

2017-02-09 Thread David Howells
Wei Yongjun wrote: > --- a/crypto/asymmetric_keys/public_key.c > +++ b/crypto/asymmetric_keys/public_key.c > @@ -184,8 +184,10 @@ static int software_key_eds_op(struct kernel_pkey_params > *params, > return PTR_ERR(tfm); > > req = akcipher_request_alloc(tfm, GFP_KERNEL); >

[GIT PULL] KEYS: Fixes and crypto fixes

2017-09-27 Thread David Howells
Hi James, Can you pull these and pass them on to Linus. There are two sets of patches here: (1) A bunch of core keyrings bug fixes from Eric Biggers. (2) Fixing big_key to use safe crypto from Jason A. Donenfeld. There are more patches to come from Eric, but I haven't reviewed at them yet, s

Re: [PATCH 1/3] crypto: dh_helper - return unsigned int for dh_data_size()

2017-10-03 Thread David Howells
Tudor Ambarus wrote: > -static inline int dh_data_size(const struct dh *p) > +static inline unsigned int dh_data_size(const struct dh *p) > { > return p->key_size + p->p_size + p->g_size; > } If this is a problem, do you need to do range checking? David

Re: general protection fault in asn1_ber_decoder

2017-11-06 Thread David Howells
oducer is attached > syzkaller reproducer is attached. See https://goo.gl/kgGztJ > for information about syzkaller reproducers Does the attached patch fix it for you? David --- commit 41f31a32d918a97dba2ec589d24b52527c8f35b6 Author: David Howells Date: Mon Nov 6 21:44:00 2017 + as

Re: general protection fault in asn1_ber_decoder

2017-11-07 Thread David Howells
Eric Biggers wrote: > Hi David, you just beat me to it, but I don't think this is the best way to > fix the problem. The length check just needs to be rewritten to not > overflow. Also it seems there is another broken length check later in the > function. How about this: Okay, fair enough. D

Re: [PATCH v2] lib/mpi: call cond_resched() from mpi_powm() loop

2017-11-08 Thread David Howells
Eric Biggers wrote: > On a non-preemptible kernel, if KEYCTL_DH_COMPUTE is called with the > largest permitted inputs (16384 bits), the kernel spends 10+ seconds > doing modular exponentiation in mpi_powm() without rescheduling. If all > threads do it, it locks up the system. Moreover, it can c

Re: [PATCH v2] lib/mpi: call cond_resched() from mpi_powm() loop

2017-11-08 Thread David Howells
Eric Biggers wrote: > This probably should be grouped with my series "crypto: dh - input validation > fixes", as this is also a fix for Diffie-Hellman. I was actually expecting > Herbert Xu to take these patches, as Diffie-Hellman is now part of the crypto > API (crypto/dh.c); none of the patche

Re: [PATCH] crypto: rsa - fix buffer overread when stripping leading zeroes

2017-11-28 Thread David Howells
Hi Herbert, Are you going to take this? David

Re: [PATCH] crypto: rsa - fix buffer overread when stripping leading zeroes

2017-11-28 Thread David Howells
Eric Biggers wrote: > In rsa_get_n(), if the buffer contained all 0's and "FIPS mode" is > enabled, we would read one byte past the end of the buffer while > scanning the leading zeroes. Fix it by checking 'n_sz' before '!*ptr'. Reviewed-by: David Howells

Re: [PATCH] X.509: fix comparisons of ->pkey_algo

2017-11-28 Thread David Howells
Eric Biggers wrote: > if (strcmp(x509->pub->pkey_algo, sinfo->sig->pkey_algo)) Can you make this strcmp(...) != 0? I know it may seem picky, but checking strcmp() in this way kind of inverts the true/false thing. Thanks, David

Re: [PATCH] X.509: fix printing uninitialized stack memory when OID is empty

2017-11-28 Thread David Howells
I wonder if all -EBADMSG returns here should just print "(badoid)" into the buffer. David

Re: [PATCH] KEYS: reject NULL restriction string when type is specified

2017-12-08 Thread David Howells
Mat Martineau wrote: > Since this fixes the bug for the asymmetric key type and ensures that other > key types won't make the same mistake, I agree this is the way to fix it. I > did not find any issues in the patch. Can I put that down as a Reviewed-by? David

Re: [PATCH v5 0/3] crypto: KEYS: convert public key to akcipher api

2016-02-06 Thread David Howells
Herbert Xu wrote: > Applied. Hmmm... That means that the crypto branch and the security branch are going to conflict. David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kerne

Re: [PATCH v5 0/3] crypto: KEYS: convert public key to akcipher api

2016-02-06 Thread David Howells
Herbert Xu wrote: > > Hmmm... That means that the crypto branch and the security branch are going > > to conflict. > > I thought you were OK with it going in now as you said that you'll > fix it up later. Sorry for the misunderstanding. Do you want me to > revert? Ummm. I did say I'd take i

Transferring applied X.509 patches from crypto/next to security/next

2016-02-08 Thread David Howells
Herbert Xu wrote: > > Hmmm... That means that the crypto branch and the security branch are going > > to conflict. > > I thought you were OK with it going in now as you said that you'll > fix it up later. Sorry for the misunderstanding. Do you want me to > revert? If you can back them out, I

Re: Transferring applied X.509 patches from crypto/next to security/next

2016-02-09 Thread David Howells
Herbert Xu wrote: > > > If you can back them out, I'll apply them to my keys-next branch. Unless > > > James is willing to rebase security/next on top of your crypto branch? > > > > > > > I don't want to rebase my tree. > > OK, I've just reverted the patches and pushed it out. Thanks. Can I

Re: [PATCH v5 0/3] crypto: KEYS: convert public key to akcipher api

2016-02-09 Thread David Howells
Are these in a public git branch somewhere that I can just merge? David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH v5 1/3] crypto: KEYS: convert public key and digsig asym to the akcipher api

2016-02-10 Thread David Howells
Why didn't you put the RSA signature parsing - ie. where the OID and the other bits are checked - into crypto/rsa.c? David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org

Re: [PATCH v5 1/3] crypto: KEYS: convert public key and digsig asym to the akcipher api

2016-02-11 Thread David Howells
Tadeusz Struk wrote: > > Why didn't you put the RSA signature parsing - ie. where the OID and the > > other > > bits are checked - into crypto/rsa.c? > > > > Do you want to get rid of the crypto/asymmetric_keys/rsa.c completely? > I wanted to make the conversion churn as small as possible. > I

Re: [PATCH v5 1/3] crypto: KEYS: convert public key and digsig asym to the akcipher api

2016-02-11 Thread David Howells
David Howells wrote: > Tadeusz Struk wrote: > > > > Why didn't you put the RSA signature parsing - ie. where the OID and the > > > other > > > bits are checked - into crypto/rsa.c? > > > > > > > Do you want to get rid of the crypto

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

2016-02-22 Thread David Howells
Tadeusz Struk 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

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

2016-02-23 Thread David Howells
Tadeusz Struk 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

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

2016-02-23 Thread David Howells
Andrew Zaborowski wrote: > AIUI Tadeusz is proposing adding the hashing as a new feature. Note > though that the hash paremeter won't make sense for the encrypt, > decrypt or verify operations. The hash parameter is necessary for the verify operation. From my perspective, I want a verify opera

Re: [PATCH] X.509: Fix test for self-signed certificate

2016-02-24 Thread David Howells
Hi Michal, I have the attached patch already in my queue. David --- commit d19fcb825912c67e09e0575b95accaa42899e07f Author: David Howells Date: Wed Feb 24 14:37:54 2016 + X.509: Don't treat self-signed keys specially Trust for a self-signed certificate can normally on

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

2016-02-24 Thread David Howells
Tadeusz Struk 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

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

2016-02-26 Thread David Howells
Andrew Zaborowski wrote: > Without overhauling akcipher you could modify pkcs1pad so that sign > takes the hash as input, adds the DER struct in front of it to build > the signature, and the verify operation could at most check that the > DER string matches the hash type and return the hash. But

Re: [PATCH 2/2] crypto: remove padding logic from rsa.c

2016-02-26 Thread David Howells
Tadeusz Struk wrote: > + if (memcmp(sig->digest, output, sig->digest_size) || I've added " != 0" after the memcmp(). > + req->dst_len != sig->digest_size) > + ret = -EBADMSG; Btw, this has to be -EKEYREJECTED; -EBADMSG would indicate that the con

Re: [PATCH 2/2] crypto: remove padding logic from rsa.c

2016-02-26 Thread David Howells
Tadeusz Struk wrote: > + if (memcmp(sig->digest, output, sig->digest_size) || > + req->dst_len != sig->digest_size) You must always do the size check first! David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to m

[PATCH 1/3] crypto: Add hash param to pkcs1pad

2016-02-26 Thread David Howells
From: Tadeusz Struk This adds hash param to pkcs1pad. The pkcs1pad template can work with or without the hash. When hash param is provided then the verify operation will also verify the output against the known digest. Signed-off-by: Tadeusz Struk Signed-off-by: David Howells --- crypto/rsa

[PATCH 0/3] KEYS: Use crypto rsa pkcs1pad module for software public keys

2016-02-26 Thread David Howells
a module in this set, but they're prerequisites for this. David --- David Howells (2): akcipher: Move the RSA DER encoding check to the crypto layer X.509: Make algo identifiers text instead of enum Tadeusz Struk (1): crypto: Add hash param to pkcs1pad crypto/asymmetric_keys/

[PATCH 1/3] crypto: Add hash param to pkcs1pad

2016-02-26 Thread David Howells
From: Tadeusz Struk This adds hash param to pkcs1pad. The pkcs1pad template can work with or without the hash. When hash param is provided then the verify operation will also verify the output against the known digest. Signed-off-by: Tadeusz Struk Signed-off-by: David Howells --- crypto/rsa

[PATCH 3/3] X.509: Make algo identifiers text instead of enum

2016-02-26 Thread David Howells
Make the identifier public key and digest algorithm fields text instead of enum. Signed-off-by: David Howells --- crypto/asymmetric_keys/mscode_parser.c| 14 +++--- crypto/asymmetric_keys/pkcs7_parser.c | 18 - crypto/asymmetric_keys/pkcs7_verify.c

[PATCH 2/3] akcipher: Move the RSA DER encoding check to the crypto layer

2016-02-26 Thread David Howells
f the code? Signed-off-by: David Howells Signed-off-by: Tadeusz Struk --- crypto/asymmetric_keys/Kconfig |7 - crypto/asymmetric_keys/Makefile|1 crypto/asymmetric_keys/public_key.c| 104 +-- crypto/asymmetric_keys/rsa.c

Re: [PATCH 0/3] KEYS: Use crypto rsa pkcs1pad module for software public keys

2016-02-29 Thread David Howells
Herbert Xu wrote: > David Howells wrote: > > > > Here's a set of patches that change the software public key asymmetric key > > subtype to use the RSA pkcs1pad module in the crypto layer. I've merged > > together mine and Tadeusz's patches. >

Re: [PATCH] PKCS#7: fix unitialized boolean 'want'

2016-02-29 Thread David Howells
Colin King wrote: > The boolean want is not initialized and hence garbage. The default should > be false (later it is only set to true on tne sinfo->authattrs check). > > Found with static analysis using CoverityScan > > Signed-off-by: Colin Ian King Applied. -- To unsubscribe from this list:

[GIT PULL] KEYS: Miscellaneous bits for security/next

2016-03-03 Thread David Howells
next Arnd Bergmann (1): modsign: hide openssl output in silent builds Codarren Velvindron (1): v2 linux-next scripts/sign-file.c Fix LibreSSL support Colin Ian King (1): PKCS#7: fix unitialized boolean 'want' David Howells (10): KEYS: Add an

Re: Left-over select to PUBLIC_KEY_ALGO_RSA

2016-03-04 Thread David Howells
Andreas Ziegler wrote: > As the corresponding option is gone, the select statement can safely be > removed. Should I prepare a simple patch for that? Please. > I detected this by using scripts/checkkconfigsymbols on today's and > yesterday's linux-next trees (i.e., "./scripts/checkkconfigsymbol

Re: [PATCH] security: integrity: Remove select to deleted option PUBLIC_KEY_ALGO_RSA

2016-03-07 Thread David Howells
Andreas Ziegler wrote: > Commit d43de6c780a8 ("akcipher: Move the RSA DER encoding check to > the crypto layer") removed the Kconfig option PUBLIC_KEY_ALGO_RSA, > but forgot to remove a 'select' to this option in the definition of > INTEGRITY_ASYMMETRIC_KEYS. > > Let's remove the select, as it's

Re: [PATCH v3 7/7] crypto: AF_ALG - add support for key_id

2016-03-30 Thread David Howells
Tadeusz Struk wrote: > + keyring = request_key(&key_type_asymmetric, key_name, NULL); > + > + err = -ENOKEY; > + if (IS_ERR(keyring)) > + goto out; > + > + pkey = keyring->payload.data[asym_crypto]; NAK. This is liable to crash in future. You may not assume that you

Re: [PATCH] PKCS#7: fix missing break on OID_sha224 case

2016-04-06 Thread David Howells
KCS#7: Add OIDs for sha224, sha284 and sha512 hash > algos and use them") > Cc: # 4.2+ > Signed-off-by: Colin Ian King Acked-by: David Howells -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.

Re: [PATCH v4 6/7] crypto: KEYS - add generic handlers to symmetric key type

2016-04-12 Thread David Howells
Tadeusz Struk wrote: > +/** > + * asymmetric_key_verify_signature - invoke verify signature operation on a > key > + *of the asymmetric subtype > + * @key: key from the system keyring > + * @sig: signature to verify > + * > + * return: 0 on success or errno on fai

Moving asymmetric keys from crypto/ to security/keys/

2016-04-13 Thread David Howells
Hi James, Herbert, Since the actual crypto bits (RSA) have been extracted from the asymmetric keys code and moved to base crypto, shall I move the asymmetric_keys/ subdir over to security/keys/? If so, how best to do it? I'm thinking that it might be best for me to create a git branch that effec

[RFC PATCH] KEYS: Provide keyctls to do public key operations

2016-04-14 Thread David Howells
out about the key. Not-yet-signed-off-by: David Howells --- Documentation/security/keys.txt | 105 + crypto/asymmetric_keys/pkcs7_parser.c |1 crypto/asymmetric_keys/public_key.c | 38 +++ crypto/asymmetric_keys/signature.c| 150 + crypto

Re: [RFC PATCH] KEYS: Provide keyctls to do public key operations

2016-04-15 Thread David Howells
Tadeusz Struk wrote: > > --- a/crypto/asymmetric_keys/signature.c > > +++ b/crypto/asymmetric_keys/signature.c > > Since this file implements the enc/dec operations also > should it be renamed to crypto/asymmetric_keys/public_key_ops.c > or something similar? signature.c is a bit confusing now.

Re: [RFC PATCH] KEYS: Provide keyctls to do public key operations

2016-04-16 Thread David Howells
Mat Martineau wrote: > > The interface for the active ops is a bit clunky as the syscall interface > > doesn't provide sufficient argument space to pass everything I need to > > specify. Some basic integer arguments are specified in a struct and more > > complex options through a string of key=v

[RFC PATCH] KEYS: Provide keyctls to do public key operations [ver #2]

2016-04-16 Thread David Howells
Here's v2 of the patch with the reported errors fixed. It's still untested by me, however. David --- KEYS: Provide keyctls to do public key operations From: David Howells Provide keyctl functions to do public key operations (sign, verify, encrypt and decrypt) if the target key sup

Re: v4.6-rc1 regression bisected, Problem loading in-kernel X.509 certificate (-2)

2016-05-03 Thread David Howells
Jamie Heilman wrote: > I usually build my kernels to require module signatures and use > automatic signing. As of v4.6-rc1 I'm getting this on boot: > > Problem loading in-kernel X.509 certificate (-2) > > I bisected that to commit d43de6c780a84def056afaf4fb3e66bdaa1efc00 > (akcipher: Move the

Re: v4.6-rc1 regression bisected, Problem loading in-kernel X.509 certificate (-2)

2016-05-03 Thread David Howells
> Problem loading in-kernel X.509 certificate (-2) ENOENT? Hmmm... The only place that is generated is in the crypto layer. That suggests missing crypto of some sort. The attached patch enables some debugging in some relevant files if you can try applying it to your kernel. David --- diff --gi

Re: v4.6-rc1 regression bisected, Problem loading in-kernel X.509 certificate (-2)

2016-05-03 Thread David Howells
(cc'ing Tadeusz as he did the pkcs1 padding function) Jamie Heilman wrote: > > > Problem loading in-kernel X.509 certificate (-2) > > > > ENOENT? Hmmm... The only place that is generated is in the crypto layer. > > That suggests missing crypto of some sort. > > > > The attached patch enables

Re: v4.6-rc1 regression bisected, Problem loading in-kernel X.509 certificate (-2)

2016-05-04 Thread David Howells
Tadeusz Struk wrote: > I think the problem is that pkcs1pad template needs CRYPTO_MANAGER, but > your configuration doesn't enable CRYPTO_MANAGER. Could you try this > please: > > diff --git a/crypto/Kconfig b/crypto/Kconfig > index 93a1fdc..1d33beb 100644 > --- a/crypto/Kconfig > +++ b/crypto/K

Re: [RFC PATCH 2/5] KEYS: Provide keyctls to drive the new key type ops for asymmetric keys

2016-05-05 Thread David Howells
I've pushed a fix to #include in keyctl_pkey.c into the git tree. David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] lib: asn1_decoder - add MODULE_LICENSE("GPL")

2016-05-11 Thread David Howells
Tudor Ambarus wrote: > A kernel taint results when loading the rsa_generic module: > > root@(none):~# modprobe rsa_generic > asn1_decoder: module license 'unspecified' taints kernel. > Disabling lock debugging due to kernel taint > > "Tainting" of the kernel is (usually) a way of indicating tha

Re: RSA/MPI handling issues and keyctl access to public key keyrings

2016-05-11 Thread David Howells
Tadeusz Struk wrote: > > (2) rsa-pkcs1pad needs to indicate what the maximum content size is, given > > the minimum possible padding for the specified hash type (ie. a > > particular OID). > > The user needs to use crypto_akcipher_maxsize(tfm) to get the required buffer > size for a g

[RFC PATCH 0/8] KEYS: keyctl operations for asymmetric keys [ver 3]

2016-05-11 Thread David Howells
eyutils changes needed can be found here: http://git.kernel.org/cgit/linux/kernel/git/dhowells/keyutils.git/log/?h=pkey David --- David Howells (8): KEYS: Provide key type operations for asymmetric key ops KEYS: Provide keyctls to drive the new key type ops for asymmetric ke

[RFC PATCH 5/8] KEYS: Provide software public key query function [ver 3]

2016-05-11 Thread David Howells
Provide a query function for the software public key implementation. This permits information about such a key to be obtained using query_asymmetric_key() or KEYCTL_PKEY_QUERY. Signed-off-by: David Howells --- crypto/asymmetric_keys/public_key.c | 96 ++- 1

[RFC PATCH 6/8] KEYS: Allow the public_key struct to hold a private key [ver 3]

2016-05-11 Thread David Howells
then need to select the appropriate crypto function to set the key. Signed-off-by: David Howells --- crypto/asymmetric_keys/public_key.c | 14 -- include/crypto/public_key.h |1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/crypto/asymmetric

[RFC PATCH 8/8] KEYS: Implement PKCS#8 RSA Private Key parser [ver 3]

2016-05-11 Thread David Howells
DER | \ keyctl padd asymmetric foo @s Signed-off-by: David Howells --- Documentation/crypto/asymmetric-keys.txt |2 crypto/asymmetric_keys/Kconfig | 10 ++ crypto/asymmetric_keys/Makefile | 13 ++ crypto/asymmetric_keys/pkcs8.asn1| 24 crypto

[RFC PATCH 7/8] KEYS: Implement encrypt, decrypt and sign for software asymmetric key [ver 3]

2016-05-11 Thread David Howells
t;/tmp/dec # cmp data /tmp/dec # keyctl pkey_sign $j 0 data enc=pkcs1 hash=sha1 >/tmp/sig # keyctl pkey_verify $j 0 data /tmp/sig enc=pkcs1 hash=sha1 # Signed-off-by: David Howells --- crypto/asymmetric_keys/public_key.c | 89 ++

[RFC PATCH 3/8] KEYS: Provide missing asymmetric key subops for new key type ops [ver 3]

2016-05-11 Thread David Howells
can be used to pass a pointer to a logon key carrying a password to unlock the key. Signed-off-by: David Howells --- Documentation/crypto/asymmetric-keys.txt | 31 +++- crypto/asymmetric_keys/asymmetric_keys.h |3 + crypto/asymmetric_keys/asymmetric_type.c | 60 ++-- crypto

[RFC PATCH 2/8] KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver 3]

2016-05-11 Thread David Howells
. Verification returns 0 on success. Signed-off-by: David Howells --- Documentation/security/keys.txt | 111 + include/uapi/linux/keyctl.h | 26 +++ security/keys/Makefile |1 security/keys/compat.c | 15 ++ security/keys/internal.h| 39

[RFC PATCH 4/8] KEYS: Make the X.509 and PKCS7 parsers supply the sig encoding type [ver 3]

2016-05-11 Thread David Howells
Make the X.509 and PKCS7 parsers fill in the signature encoding type field recently added to the public_key_signature struct. Signed-off-by: David Howells --- crypto/asymmetric_keys/pkcs7_parser.c |1 + crypto/asymmetric_keys/x509_cert_parser.c | 21 + 2 files

[RFC PATCH 1/8] KEYS: Provide key type operations for asymmetric key ops [ver 3]

2016-05-11 Thread David Howells
supply the data and the signature instead and get an error value (or 0) as the only result on the expectation that this may well be how a hardware crypto device may work. Signed-off-by: David Howells --- Documentation/security/keys.txt | 113 +++ include/linux/

Re: [PATCH RESEND v5 0/6] crypto: algif - add akcipher

2016-05-11 Thread David Howells
Tadeusz Struk wrote: > This is the same v5 version as before rebased on top of > http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-asym-keyctl I've just reposted this. The interface you're using should be the same, I think, but the details underneath have changed. A

Re: [RFC PATCH 2/8] KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver 3]

2016-05-12 Thread David Howells
Mat Martineau wrote: > > + If the key must be unlocked with a password before it can be used, > > + password_id should point to a logon-type key that holds this. > > It should be noted that the password_id should be 0 if no password is to be > used. Currently I'm just ignoring it if I d

Re: [RFC PATCH 5/8] KEYS: Provide software public key query function [ver 3]

2016-05-12 Thread David Howells
Mat Martineau wrote: > > + len = crypto_akcipher_maxsize(tfm); > > + info->key_size = len * 8; > > + info->max_data_size = len; > > + info->max_sig_size = len; > > + info->max_enc_size = len; > > + info->max_dec_size = len; > > If len > UINT16_MAX, should UINT16_MAX be reported as th

Re: [RFC PATCH 8/8] KEYS: Implement PKCS#8 RSA Private Key parser [ver 3]

2016-05-12 Thread David Howells
Mat Martineau wrote: > > # PKCS#7 message handling > > Update to PKCS#8 I guess I've typed PKCS#7 too many times :-) David -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel

Re: key retention service: DH support

2016-05-24 Thread David Howells
Stephan Mueller wrote: > With the new DH support for the key retention service, support for DH derived > keys pops up. > > The implementation in security/keys/dh.c returns the DH shared secret > straight > to the user space caller. > > I implemented a KDF with that exact scenario already in

Re: key retention service: DH support

2016-05-24 Thread David Howells
Stephan Mueller wrote: > The KDF patches are fully tested. All that would be needed on the key > retention side after the shared secret generation are the following calls: > > kdf = crypto_alloc_rng(NAME, 0, 0); > > crypto_rng_reset(kdf, , sizeof()); > > crypto_rng_generate(kdf, LABEL, sizeof

Re: key retention service: DH support

2016-05-25 Thread David Howells
Mat Martineau wrote: > Since the KDF patches are not yet merged, I'm not sure of the best way to > accomodate the future feature. We could future-proof KEYCTL_DH_COMPUTE by > adding a 5th arg, an optional pointer to KDF configuration (NAME and > LABEL). If we want to do this, it needs to be done

Re: [PATCH] KEYS: Add optional key derivation parameters for DH

2016-05-26 Thread David Howells
Mat Martineau wrote: > +struct keyctl_kdf_params { > + char *name; > + __u8 reserved[32]; /* Reserved for future use, must be 0 */ > +}; > + > #endif /* _LINUX_KEYCTL_H */ > diff --git a/security/keys/compat.c b/security/keys/compat.c > index c8783b3..36c80bf 100644 > --- a/security/key

[PATCH] KEYS: Add placeholder for KDF usage with DH

2016-05-26 Thread David Howells
ineau Signed-off-by: Stephan Mueller Signed-off-by: David Howells --- Documentation/security/keys.txt |5 - security/keys/compat.c |2 +- security/keys/dh.c |8 +++- security/keys/internal.h|5 +++-- security/keys/keyctl.c |4 ++

Re: [PATCH] KEYS: Add placeholder for KDF usage with DH

2016-05-31 Thread David Howells
Hi James, > Could you pass this along to Linus as soon as possible, please? This > alters a new keyctl function added in the current merge window to allow for > a future extension planned for the next merge window. Is this likely to go to Linus before -rc2? If not, we'll need to do things diffe

Re: KEYS: Use skcipher for big keys

2016-06-22 Thread David Howells
cryptodev so I can carry on with the removal of blkcipher. As long as it only touches the big_key code inside keyrings, I think that's fine. Acked-by: David Howells -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@v

[PATCH 1/8] KEYS: Provide key type operations for asymmetric key ops [ver #2]

2016-06-23 Thread David Howells
ta and the signature instead and get an error value (or 0) as the only result on the expectation that this may well be how a hardware crypto device may work. Signed-off-by: David Howells --- Documentation/security/keys.txt | 106 +++ include/linux/

[PATCH 0/8] KEYS: keyctl operations for asymmetric keys

2016-06-23 Thread David Howells
/keyutils.git/log/?h=pkey David --- David Howells (8): KEYS: Provide key type operations for asymmetric key ops KEYS: Provide keyctls to drive the new key type ops for asymmetric keys KEYS: Provide missing asymmetric key subops for new key type ops KEYS: Make the X.509 and PKCS7 pars

[PATCH 7/8] KEYS: Implement encrypt, decrypt and sign for software asymmetric key [ver #2]

2016-06-23 Thread David Howells
t;/tmp/dec # cmp data /tmp/dec # keyctl pkey_sign $j 0 data enc=pkcs1 hash=sha1 >/tmp/sig # keyctl pkey_verify $j 0 data /tmp/sig enc=pkcs1 hash=sha1 # Signed-off-by: David Howells --- crypto/asymmetric_keys/public_key.c | 89 ++

[PATCH 8/8] KEYS: Implement PKCS#8 RSA Private Key parser [ver #2]

2016-06-23 Thread David Howells
DER | \ keyctl padd asymmetric foo @s Signed-off-by: David Howells --- Documentation/crypto/asymmetric-keys.txt |2 crypto/asymmetric_keys/Kconfig | 10 ++ crypto/asymmetric_keys/Makefile | 13 ++ crypto/asymmetric_keys/pkcs8.asn1| 24 crypto

  1   2   3   4   5   >