Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_digest.c File Reference
#include "nilorea/n_common.h"
#include "nilorea/n_digest.h"
#include "nilorea/n_hex.h"
#include "nilorea/n_log.h"
#include "nilorea/n_str.h"
#include <stdio.h>
#include <string.h>
+ Include dependency graph for ex_digest.c:

Go to the source code of this file.

Functions

static void expect_hex (const unsigned char *digest, size_t len, const char *want, const char *label)
 
int main (int argc, char **argv)
 
void process_args (int argc, char **argv)
 
static void test_aead (void)
 
static void test_consttime (void)
 
static void test_digests (void)
 
static void test_errors (void)
 
static void test_hmac (void)
 
static void test_hmac_variants (void)
 
static void test_pbkdf2 (void)
 
static void test_sha256_hex (void)
 

Variables

static int failures = 0
 

Function Documentation

◆ expect_hex()

static void expect_hex ( const unsigned char *  digest,
size_t  len,
const char *  want,
const char *  label 
)
static
Examples
ex_digest.c.

Definition at line 71 of file ex_digest.c.

References N_STR::data, failures, free_nstr, LOG_ERR, n_hex_encode(), and n_log.

Referenced by test_aead(), test_digests(), test_hmac(), test_hmac_variants(), and test_pbkdf2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char **  argv 
)

◆ process_args()

void process_args ( int  argc,
char **  argv 
)

Definition at line 39 of file ex_digest.c.

References LOG_DEBUG, LOG_ERR, LOG_INFO, LOG_NOTICE, LOG_NULL, and set_log_level().

+ Here is the call graph for this function:

◆ test_aead()

static void test_aead ( void  )
static
Examples
ex_digest.c.

Definition at line 225 of file ex_digest.c.

References expect_hex(), failures, key, n_aead_aes256gcm_decrypt(), n_aead_aes256gcm_encrypt(), N_AEAD_AES256GCM_KEY_LEN, and N_AEAD_AES256GCM_TAG_LEN.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_consttime()

static void test_consttime ( void  )
static
Examples
ex_digest.c.

Definition at line 183 of file ex_digest.c.

References failures, and n_digest_consttime_equal().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_digests()

static void test_digests ( void  )
static
Examples
ex_digest.c.

Definition at line 85 of file ex_digest.c.

References expect_hex(), failures, n_digest_md5(), N_DIGEST_MD5_LEN, n_digest_sha1(), N_DIGEST_SHA1_LEN, n_digest_sha256(), N_DIGEST_SHA256_LEN, n_digest_sha384(), N_DIGEST_SHA384_LEN, n_digest_sha512(), and N_DIGEST_SHA512_LEN.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_errors()

static void test_errors ( void  )
static
Examples
ex_digest.c, and ex_dns.c.

Definition at line 274 of file ex_digest.c.

References failures, LOG_ERR, n_digest_sha256(), N_DIGEST_SHA256_LEN, n_hmac_sha256(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_hmac()

static void test_hmac ( void  )
static
Examples
ex_digest.c.

Definition at line 141 of file ex_digest.c.

References expect_hex(), failures, key, LOG_ERR, N_DIGEST_SHA256_LEN, n_hmac_sha256(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_hmac_variants()

static void test_hmac_variants ( void  )
static
Examples
ex_digest.c.

Definition at line 154 of file ex_digest.c.

References expect_hex(), failures, key, N_DIGEST_SHA1_LEN, N_DIGEST_SHA384_LEN, N_DIGEST_SHA512_LEN, n_hmac_sha1(), n_hmac_sha384(), and n_hmac_sha512().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_pbkdf2()

static void test_pbkdf2 ( void  )
static
Examples
ex_digest.c.

Definition at line 196 of file ex_digest.c.

References expect_hex(), failures, n_pbkdf2_hmac_sha1(), and n_pbkdf2_hmac_sha256().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_sha256_hex()

static void test_sha256_hex ( void  )
static
Examples
ex_digest.c.

Definition at line 124 of file ex_digest.c.

References N_STR::data, failures, free_nstr, LOG_ERR, n_digest_sha256_hex(), and n_log.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Definition at line 36 of file ex_digest.c.