aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/hw_random/msm_rng.h
blob: d3a2e8339955aa06a4f99c55ef60a5ed025ea0c1 (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
45
46
47
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __MSM_RNG_HEADER__
#define __MSM_RNG_HEADER__

#include <linux/semaphore.h>
#include <linux/qcedev.h>

struct _fips_drbg_ctx;

#define FIPS140_DRBG_ENABLED  (1)
#define FIPS140_DRBG_DISABLED (0)

#define Q_HW_DRBG_BLOCK_BYTES (32)

extern void fips_reg_drbg_callback(void *src);

struct msm_rng_device {
	struct platform_device *pdev;
	void __iomem *base;
	struct clk *prng_clk;
	uint32_t qrng_perf_client;
	struct mutex rng_lock;
	struct fips_drbg_ctx_s *drbg_ctx;
	int    fips140_drbg_enabled;
};

/*
 *
 *  This function calls hardware random bit generator
 *  directory and retuns it back to caller.
 *
 */
int msm_rng_direct_read(struct msm_rng_device *msm_rng_dev, void *data);

#endif