Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile secp256 in U-boot #603

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ gen_context
*.a
!.gitignore

Makefile
configure
.libs/
Makefile.in
Expand Down
12 changes: 12 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
config DSA
bool "Use secp256k DSA Library"
help
DSA support. This enables the ECDSA algorithm used for FIT image
verification in U-Boot.
See doc/uImage.FIT/signature.txt for more details.
if DSA

config SPL_DSA
bool "Use DSA Library within SPL"

endif
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-License-Identifier: GPL-2.0+
#
# note this is NOT autogenerated from Makefile.am, etc
#
#
# Copyright (c) 2013, Google Inc.
#
# (C) Copyright 2000-2007
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
# (C) Copyright 2019, SiFive Inc

obj-$(CONFIG_$(SPL_)FIT_SIGNATURE) += src/secp256k1.o
7 changes: 5 additions & 2 deletions src/ecmult_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#ifndef SECP256K1_ECMULT_IMPL_H
#define SECP256K1_ECMULT_IMPL_H

/*
#include <string.h>
#include <stdint.h>
*/
#include <linux/types.h>

#include "group.h"
#include "scalar.h"
Expand Down Expand Up @@ -785,7 +788,7 @@ static size_t secp256k1_pippenger_bucket_window_inv(int bucket_window) {
case 9: return 4420;
case 10: return 7880;
case 11: return 16050;
case PIPPENGER_MAX_BUCKET_WINDOW: return SIZE_MAX;
case PIPPENGER_MAX_BUCKET_WINDOW: return __SIZE_MAX__;
#else
case 1: return 1;
case 2: return 11;
Expand All @@ -798,7 +801,7 @@ static size_t secp256k1_pippenger_bucket_window_inv(int bucket_window) {
case 9: return 9630;
case 10: return 17900;
case 11: return 32800;
case PIPPENGER_MAX_BUCKET_WINDOW: return SIZE_MAX;
case PIPPENGER_MAX_BUCKET_WINDOW: return __SIZE_MAX__;
#endif
}
return 0;
Expand Down
5 changes: 5 additions & 0 deletions src/field_10x26.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
#ifndef SECP256K1_FIELD_REPR_H
#define SECP256K1_FIELD_REPR_H

/*
#include <stdint.h>
*/
#include <linux/types.h>



typedef struct {
/* X = sum(i=0..9, elem[i]*2^26) mod n */
Expand Down
3 changes: 3 additions & 0 deletions src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
#define SECP256K1_HASH_H

#include <stdlib.h>
/*
#include <stdint.h>
*/
#include <linux/types.h>

typedef struct {
uint32_t s[8];
Expand Down
6 changes: 5 additions & 1 deletion src/hash_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
#include "hash.h"

#include <stdlib.h>
#include <stdint.h>
/*
#include <string.h>
#include <stdint.h>
*/
#include <linux/types.h>


#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
#define Maj(x,y,z) (((x) & (y)) | ((z) & ((x) | (y))))
Expand Down
4 changes: 4 additions & 0 deletions src/scalar_8x32.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#ifndef SECP256K1_SCALAR_REPR_H
#define SECP256K1_SCALAR_REPR_H

/*
#include <stdint.h>
*/
#include <linux/types.h>


/** A scalar modulo the group order of the secp256k1 curve. */
typedef struct {
Expand Down
5 changes: 4 additions & 1 deletion src/secp256k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/

#include "include/secp256k1.h"
#define USE_BASIC_CONFIG 1
#include "basic-config.h"

#include "../include/secp256k1.h"

#include "util.h"
#include "num_impl.h"
Expand Down
5 changes: 4 additions & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#include "libsecp256k1-config.h"
#endif

#include <stdlib.h>
/*
#include <stdint.h>
*/
#include <linux/types.h>
#include <stdlib.h>
#include <stdio.h>

typedef struct {
Expand Down