mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly
For automated changes based on OAI PL v1.1:
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml
The rest (cmake, files with missing license, cmake) manually.
70 lines
1.6 KiB
C
70 lines
1.6 KiB
C
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <unistd.h>
|
|
|
|
#include "test_util.h"
|
|
|
|
#include "secu_defs.h"
|
|
|
|
#include <openssl/aes.h>
|
|
#include <openssl/cmac.h>
|
|
#include <openssl/evp.h>
|
|
|
|
static CMAC_CTX *ctx;
|
|
|
|
static
|
|
void test_cmac(const uint8_t *key, unsigned key_length, const uint8_t *message,
|
|
unsigned length, const uint8_t *expect, unsigned expected_length)
|
|
{
|
|
size_t size;
|
|
uint8_t result[16];
|
|
|
|
ctx = CMAC_CTX_new();
|
|
|
|
CMAC_Init(ctx, key, key_length, EVP_aes_128_cbc(), NULL);
|
|
CMAC_Update(ctx, message, length);
|
|
CMAC_Final(ctx, result, &size);
|
|
|
|
CMAC_CTX_free(ctx);
|
|
|
|
if (compare_buffer(result, size, expect, expected_length) != 0) {
|
|
fail("test_cmac");
|
|
}
|
|
}
|
|
|
|
void doit (void)
|
|
{
|
|
/* SP300-38B #D.1 */
|
|
|
|
/* Example 1 */
|
|
test_cmac(
|
|
HL("2b7e151628aed2a6abf7158809cf4f3c"),
|
|
HL(""),
|
|
HL("bb1d6929e95937287fa37d129b756746"));
|
|
/* Example 2 */
|
|
test_cmac(
|
|
HL("2b7e151628aed2a6abf7158809cf4f3c"),
|
|
HL("6bc1bee22e409f96e93d7e117393172a"),
|
|
HL("070a16b46b4d4144f79bdd9dd04a287c"));
|
|
/* Example 3 */
|
|
test_cmac(
|
|
HL("2b7e151628aed2a6abf7158809cf4f3c"),
|
|
HL("6bc1bee22e409f96e93d7e117393172a"
|
|
"ae2d8a571e03ac9c9eb76fac45af8e51"
|
|
"30c81c46a35ce411"),
|
|
HL("dfa66747de9ae63030ca32611497c827"));
|
|
/* Example 4 */
|
|
test_cmac(
|
|
HL("2b7e151628aed2a6abf7158809cf4f3c"),
|
|
HL("6bc1bee22e409f96e93d7e117393172a"
|
|
"ae2d8a571e03ac9c9eb76fac45af8e51"
|
|
"30c81c46a35ce411e5fbc1191a0a52ef"
|
|
"f69f2445df4f9b17ad2b417be66c3710"),
|
|
HL("51f0bebf7e3b9d92fc49741779363cfe"));
|
|
}
|