Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db6c43bd authored by Tadeusz Struk's avatar Tadeusz Struk Committed by David Howells
Browse files

crypto: KEYS: convert public key and digsig asym to the akcipher api



This patch converts the module verification code to the new akcipher API.

Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 50d35015
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ config ASYMMETRIC_PUBLIC_KEY_SUBTYPE

config PUBLIC_KEY_ALGO_RSA
	tristate "RSA public-key algorithm"
	select MPILIB
	select CRYPTO_RSA
	help
	  This option enables support for the RSA algorithm (PKCS#1, RFC3447).

+2 −5
Original line number Diff line number Diff line
@@ -16,21 +16,18 @@ obj-$(CONFIG_X509_CERTIFICATE_PARSER) += x509_key_parser.o
x509_key_parser-y := \
	x509-asn1.o \
	x509_akid-asn1.o \
	x509_rsakey-asn1.o \
	x509_cert_parser.o \
	x509_public_key.o

$(obj)/x509_cert_parser.o: \
	$(obj)/x509-asn1.h \
	$(obj)/x509_akid-asn1.h \
	$(obj)/x509_rsakey-asn1.h
	$(obj)/x509_akid-asn1.h

$(obj)/x509-asn1.o: $(obj)/x509-asn1.c $(obj)/x509-asn1.h
$(obj)/x509_akid-asn1.o: $(obj)/x509_akid-asn1.c $(obj)/x509_akid-asn1.h
$(obj)/x509_rsakey-asn1.o: $(obj)/x509_rsakey-asn1.c $(obj)/x509_rsakey-asn1.h

clean-files	+= x509-asn1.c x509-asn1.h
clean-files	+= x509_akid-asn1.c x509_akid-asn1.h
clean-files	+= x509_rsakey-asn1.c x509_rsakey-asn1.h

#
# PKCS#7 message handling
+5 −7
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/oid_registry.h>
#include "public_key.h"
#include <crypto/public_key.h>
#include "pkcs7_parser.h"
#include "pkcs7-asn1.h"

@@ -44,7 +44,7 @@ struct pkcs7_parse_context {
static void pkcs7_free_signed_info(struct pkcs7_signed_info *sinfo)
{
	if (sinfo) {
		mpi_free(sinfo->sig.mpi[0]);
		kfree(sinfo->sig.s);
		kfree(sinfo->sig.digest);
		kfree(sinfo->signing_cert_id);
		kfree(sinfo);
@@ -614,16 +614,14 @@ int pkcs7_sig_note_signature(void *context, size_t hdrlen,
			     const void *value, size_t vlen)
{
	struct pkcs7_parse_context *ctx = context;
	MPI mpi;

	BUG_ON(ctx->sinfo->sig.pkey_algo != PKEY_ALGO_RSA);

	mpi = mpi_read_raw_data(value, vlen);
	if (!mpi)
	ctx->sinfo->sig.s = kmemdup(value, vlen, GFP_KERNEL);
	if (!ctx->sinfo->sig.s)
		return -ENOMEM;

	ctx->sinfo->sig.mpi[0] = mpi;
	ctx->sinfo->sig.nr_mpi = 1;
	ctx->sinfo->sig.s_size = vlen;
	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
#include <linux/asn1.h>
#include <linux/key.h>
#include <keys/asymmetric-type.h>
#include "public_key.h"
#include <crypto/public_key.h>
#include "pkcs7_parser.h"

/**
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <linux/err.h>
#include <linux/asn1.h>
#include <crypto/hash.h>
#include "public_key.h"
#include <crypto/public_key.h>
#include "pkcs7_parser.h"

/*
Loading