18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ciif [ ! -f "$1" ]; then
58c2ecf20Sopenharmony_ci	SEED=`od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n'`
68c2ecf20Sopenharmony_ci	echo "const char *randstruct_seed = \"$SEED\";" > "$1"
78c2ecf20Sopenharmony_ci	HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'`
88c2ecf20Sopenharmony_ci	echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"
98c2ecf20Sopenharmony_cifi
10