1 /* 2 * Copyright (C) 2016-2017 The Android Open Source Project 3 * Copyright 2017 NXP 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #include <assert.h> 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <string.h> 22 #include <uapi/err.h> 23 24 #include "caam.h" 25 #include "common.h" 26 #include "hwrng_srv_priv.h" 27 28 #define TLOG_TAG "hwrng_caam" 29 #include <trusty_log.h> 30 hwrng_dev_get_rng_data(uint8_t * buf,size_t buf_len)31void hwrng_dev_get_rng_data(uint8_t* buf, size_t buf_len) { 32 uint32_t res = caam_hwrng(buf, buf_len); 33 assert(res == CAAM_SUCCESS); 34 } 35 hwrng_init_srv_provider(void)36void hwrng_init_srv_provider(void) { 37 int rc; 38 39 TLOGE("Init HWRNG service provider\n"); 40 /* Nothing to initialize here, just start service */ 41 rc = hwrng_start_service(); 42 if (rc != NO_ERROR) { 43 TLOGE("failed (%d) to start HWRNG service\n", rc); 44 } 45 } 46