summaryrefslogtreecommitdiff
path: root/curve.h
blob: 1b3a9195dddb867f1170c781f469dfbb8377e73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef CURVE_H
#define CURVE_H

#include "locking.h"
#include "built_in.h"
#include "ioops.h"
#include "rnd.h"
#include "taia.h"
#include "crypto.h"

struct curve25519_proto {
	unsigned char enonce[crypto_box_noncebytes] __aligned_16;
	unsigned char dnonce[crypto_box_noncebytes] __aligned_16;
	unsigned char key[crypto_box_beforenmbytes] __aligned_16;
};

struct curve25519_struct {
	unsigned char *enc, *dec;
	size_t enc_size, dec_size;
	struct spinlock enc_lock, dec_lock;
};

extern void curve25519_selftest(void);

extern struct curve25519_struct *curve25519_tfm_alloc(void);
extern void curve25519_tfm_free(struct curve25519_struct *tfm);
extern void curve25519_tfm_free_void(void *tfm);

extern void curve25519_proto_init(struct curve25519_proto *proto,
				  unsigned char *pubkey_remote, size_t len);
extern int curve25519_pubkey_hexparse_32(unsigned char *bin, size_t blen,
					 const char *ascii, size_t alen);

extern ssize_t curve25519_encode(struct curve25519_struct *curve,
				 struct curve25519_proto *proto,
				 unsigned char *plaintext, size_t size,
				 unsigned char **ciphertext);
extern ssize_t curve25519_decode(struct curve25519_struct *curve,
				 struct curve25519_proto *proto,
				 unsigned char *ciphertext, size_t size,
				 unsigned char **plaintext,
				 struct taia *arrival_taia);

#endif /* CURVE_H */
ext.git/diff/Documentation/kobject.txt?h=nds-private-remove&id=eda5ecc0a6b865561997e177c393f0b0136fe3b7&id2=ca3704c23a3b3dfc9d721cf21953fd6b3cbfc3e0'>diff)
Input: pmic8xxx-pwrkey - fix algorithm for converting trigger delay
The trigger delay algorithm that converts from microseconds to the register value looks incorrect. According to most of the PMIC documentation, the equation is delay (Seconds) = (1 / 1024) * 2 ^ (x + 4) except for one case where the documentation looks to have a formatting issue and the equation looks like delay (Seconds) = (1 / 1024) * 2 x + 4 Most likely this driver was written with the improper documentation to begin with. According to the downstream sources the valid delays are from 2 seconds to 1/64 second, and the latter equation just doesn't make sense for that. Let's fix the algorithm and the range check to match the documentation and the downstream sources. Reported-by: Bjorn Andersson <bjorn.andersson@linaro.org> Fixes: 92d57a73e410 ("input: Add support for Qualcomm PMIC8XXX power key") Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Tested-by: John Stultz <john.stultz@linaro.org> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'Documentation/kobject.txt')