Skip to main content

crypto_get_random_values

Function crypto_get_random_values 

Source
pub(crate) fn crypto_get_random_values(
    _it: &mut Interp,
    _t: Value,
    a: &[Value],
) -> Result<Value, Value>
Expand description

crypto.getRandomValues(typedArray)。以前は種別を無視して全要素を無条件に & 0xff(0-255)で埋めており、Int16Array/Int32Array/Uint32Array 等 8bit より広い型に対しては本来の値域のごく一部(下位8bitのみ、常に非負)しか 埋められない、実質的にランダム性が大幅に弱まるバグだった。_ta_kind タグから 種別を復元し、コンストラクタ/set/索引代入と同じ TaKind::convert() で 型ごとの正しい値域に変換する。