wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
crypto_internal-modexp.c File Reference

Crypto wrapper for internal crypto implementation - modexp. More...

#include "includes.h"
#include "common.h"
#include "tls/bignum.h"
#include "crypto.h"

Functions

int crypto_mod_exp (const u8 *base, size_t base_len, const u8 *power, size_t power_len, const u8 *modulus, size_t modulus_len, u8 *result, size_t *result_len)
 Modular exponentiation of large integers. More...
 

Detailed Description

Crypto wrapper for internal crypto implementation - modexp.

Function Documentation

int crypto_mod_exp ( const u8 *  base,
size_t  base_len,
const u8 *  power,
size_t  power_len,
const u8 *  modulus,
size_t  modulus_len,
u8 *  result,
size_t *  result_len 
)

Modular exponentiation of large integers.

Parameters
baseBase integer (big endian byte array)
base_lenLength of base integer in bytes
powerPower integer (big endian byte array)
power_lenLength of power integer in bytes
modulusModulus integer (big endian byte array)
modulus_lenLength of modulus integer in bytes
resultBuffer for the result
result_lenResult length (max buffer size on input, real len on output)
Returns
0 on success, -1 on failure

This function calculates result = base ^ power mod modulus. modules_len is used as the maximum size of modulus buffer. It is set to the used size on success.

This function is only used with internal TLSv1 implementation (CONFIG_TLS=internal). If that is not used, the crypto wrapper does not need to implement this.