Skip to content

Commit

Permalink
adding uica to bins
Browse files Browse the repository at this point in the history
  • Loading branch information
dderjoel committed Jun 18, 2024
1 parent eaa2e85 commit b627b56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

NODE_DIR := $(ROOT)/bins/node
NODE := $(ROOT)/bins/node/bin/node
UICA := $(ROOT)/bins/uiCA
NODE_VERSION := 22.3.0

PATH := $(NODE_DIR)/bin:$(PATH)
Expand All @@ -27,6 +28,11 @@ BUILT_CRYPTOPT := $(ROOT)/dist/CryptOpt.js
all: clean $(BUILT_CRYPTOPT)
build: $(BUILT_CRYPTOPT)

$(UICA):
mkdir -p ./bins
git clone https://github.com/andreas-abel/uiCA.git bins/uiCA
cd bins/uiCA && ./setup.sh

$(NODE):
mkdir -p ./bins
curl -L https://nodejs.org/dist/v$(NODE_VERSION)/node-v$(NODE_VERSION)-linux-x64.tar.xz | tar --extract --xz --directory ./bins
Expand All @@ -42,7 +48,7 @@ FIAT_BINARIES=unsaturated_solinas word_by_word_montgomery dettman_multiplication
$(FIAT_CHECKSUMS): $(addprefix $(FIAT_DATA_DIR)/, $(FIAT_BINARIES))
cd $(FIAT_DATA_DIR) && sha256sum $(FIAT_BINARIES) > $(notdir $(FIAT_CHECKSUMS))

$(BUILT_CRYPTOPT): $(NODE) node_modules $(shell find ./src -type f -name '*ts') $(FIAT_CHECKSUMS)
$(BUILT_CRYPTOPT): $(NODE) $(UICA) node_modules $(shell find ./src -type f -name '*ts') $(FIAT_CHECKSUMS)
@echo "Building CryptOpt"
@PATH=$(PATH) npm run bundle
@test -e "$(@)" && touch $(@) && echo "Successfully built CryptOpt. :)"
Expand Down
2 changes: 1 addition & 1 deletion src/optimizer/measure.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default class MeasureUtil {

// call uiCA
const uiCAArgs = ["-TPonly", "-arch", this.timer, "-raw", join(tmpDir, "binary.bin")];
const r = spawnSync("./uiCA", uiCAArgs);
const r = spawnSync("./bins/uiCA/uiCA.py", uiCAArgs);
if (r.status != 0) {
throw new Error(
`uiCA command failed. STDERR:${r.stderr}, STDOUT: ${r.stdout}. May be because ./uiCA is not in the cwd.`,
Expand Down

0 comments on commit b627b56

Please sign in to comment.