MCPcopy Create free account
hub / github.com/F-Stack/f-stack / random_ccp_read

Function random_ccp_read

freebsd/crypto/ccp/ccp_hardware.c:2006–2027  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2004
2005#define MAX_TRNG_RETRIES 10
2006u_int
2007random_ccp_read(void *v, u_int c)
2008{
2009 uint32_t *buf;
2010 u_int i, j;
2011
2012 KASSERT(c % sizeof(*buf) == 0, ("%u not multiple of u_long", c));
2013
2014 buf = v;
2015 for (i = c; i > 0; i -= sizeof(*buf)) {
2016 for (j = 0; j < MAX_TRNG_RETRIES; j++) {
2017 *buf = ccp_read_4(g_ccp_softc, TRNG_OUT_OFFSET);
2018 if (*buf != 0)
2019 break;
2020 }
2021 if (j == MAX_TRNG_RETRIES)
2022 return (0);
2023 buf++;
2024 }
2025 return (c);
2026
2027}
2028
2029#ifdef DDB
2030void

Callers

nothing calls this directly

Calls 1

ccp_read_4Function · 0.85

Tested by

no test coverage detected