Skip to content

Commit

Permalink
fix no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
makavity committed May 10, 2024
1 parent e2cc8a3 commit 518c102
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions bign256/src/ecdsa/verifying.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
//! 9. Return YES.
//! ```

#[cfg(feature = "alloc")]
use alloc::boxed::Box;

use super::{Signature, BELT_OID};
use crate::{
AffinePoint, BignP256, EncodedPoint, FieldBytes, Hash, ProjectivePoint, PublicKey, Scalar,
Expand Down
5 changes: 2 additions & 3 deletions bign256/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// #![no_std]
// #![no_std]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc = include_str!("../README.md")]
#![doc(
Expand Down Expand Up @@ -58,7 +57,7 @@ const ALGORITHM_OID: pkcs8::ObjectIdentifier =
pkcs8::ObjectIdentifier::new_unwrap("1.2.112.0.2.0.34.101.45.2.1");

#[cfg(feature = "ecdsa")]
type Hash = belt_hash::digest::Output<belt_hash::BeltHash>;
type Hash = digest::Output<belt_hash::BeltHash>;

/// Order of BIGN P-256's elliptic curve group (i.e. scalar modulus) in hexadecimal.
const ORDER_HEX: &str = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD95C8ED60DFB4DFC7E5ABF99263D6607";
Expand Down
7 changes: 4 additions & 3 deletions bign256/src/public_key.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Public key types and traits

use core::fmt::Display;
use core::str::FromStr;
#[cfg(feature = "alloc")]
use alloc::{boxed::Box, fmt};
use core::{fmt::Display, str::FromStr};

use elliptic_curve::{
array::Array,
Expand Down Expand Up @@ -198,7 +199,7 @@ impl FromStr for PublicKey {

#[cfg(feature = "pem")]
impl Display for PublicKey {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
Expand Down
2 changes: 1 addition & 1 deletion bign256/src/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl TryFrom<pkcs8::PrivateKeyInfo<'_>> for SecretKey {
#[cfg(feature = "pem")]
impl FromStr for SecretKey {
type Err = Error;
fn from_str(s: &str) -> std::result::Result<Self, Error> {
fn from_str(s: &str) -> core::result::Result<Self, Error> {
Self::from_pkcs8_pem(s).map_err(|_| Error)
}
}
Expand Down

0 comments on commit 518c102

Please sign in to comment.