takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaMacCrypto_stub.cpp Source File

LoRaMacCrypto_stub.cpp

00001 /*
00002  * Copyright (c) , Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #include <stdlib.h>
00019 #include <stdint.h>
00020 
00021 #include "LoRaMacCrypto.h"
00022 #include "system/lorawan_data_structures.h"
00023 
00024 #include "LoRaMacCrypto_stub.h"
00025 
00026 int LoRaMacCrypto_stub::int_table_idx_value = 0;
00027 int LoRaMacCrypto_stub::int_table[20] = {};
00028 
00029 LoRaMacCrypto::LoRaMacCrypto()
00030 {
00031 }
00032 
00033 int LoRaMacCrypto::compute_mic(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
00034                                uint8_t dir, uint32_t, uint32_t *)
00035 {
00036     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00037 }
00038 
00039 int LoRaMacCrypto::encrypt_payload(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
00040                                    uint8_t , uint32_t , uint8_t *)
00041 {
00042     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00043 }
00044 
00045 int LoRaMacCrypto::decrypt_payload(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t,
00046                                    uint8_t , uint32_t , uint8_t *)
00047 {
00048     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00049 }
00050 
00051 int LoRaMacCrypto::compute_join_frame_mic(const uint8_t *, uint16_t , const uint8_t *, uint32_t, uint32_t *)
00052 {
00053     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00054 }
00055 
00056 int LoRaMacCrypto::decrypt_join_frame(const uint8_t *in, uint16_t size, const uint8_t *, uint32_t, uint8_t *out)
00057 {
00058     memcpy(out, in, size);
00059     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00060 }
00061 
00062 int LoRaMacCrypto::compute_skeys_for_join_frame(const uint8_t *, uint32_t, const uint8_t *, uint16_t ,
00063                                                 uint8_t *, uint8_t *)
00064 {
00065     return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
00066 }