pq_crypto 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5949078149668609462a1e9a3df7b7f767499311b998e4dd651be1d7865ddfc
4
- data.tar.gz: 600fc91b9614aec5f7f61d8c3ab6d11643bbbf919941faf0508384e7ede9dce0
3
+ metadata.gz: '0911b99fec80d68a6dff827829bbd77a28951d70c4a85f4fc68bc8c03bdffdda'
4
+ data.tar.gz: fb7f9e92387316b6641b191dc1d1f5c469f5297d866301a21d44d4eb789185e6
5
5
  SHA512:
6
- metadata.gz: 2ac70b6f37460e0a56b1601b59ba5660dda7e4c0c87cc03211c9497261b06f632856079622546f6c8b6db6cfff97b1a9355db879958985f48dfe296c5d729b80
7
- data.tar.gz: 9e89256c60b8153518520438b77632eb232660ff88d0b0668cfb8aeea7a50875c2c7297773f3d469952129ccceb6e604e4f619cc4cc2ebbd458fdca9d50e837f
6
+ metadata.gz: 0a614e2b3a645332a3543062efd754421a4a002f08b7b2b71463ee2817f5008a14e65745c66d0c24b5b11a1ecb020f4fe9d479ff59676ddf770186d8d286e26a
7
+ data.tar.gz: ef7bd96e717b4a99b74346dfd2c98c4787bc3b09b3a1199acfe01b0a22ea2f26cfd594499f3948241abf207dab9d5602f21aaa0a21c66742710637ce53f1a07f
@@ -31,7 +31,7 @@ jobs:
31
31
  fail-fast: false
32
32
  matrix:
33
33
  os: [ubuntu-latest, macos-latest]
34
- ruby: ["3.4", "4.0"]
34
+ ruby: ["3.1", "3.4", "4.0"]
35
35
 
36
36
  steps:
37
37
  - name: Checkout
@@ -116,3 +116,50 @@ jobs:
116
116
  echo "OpenSSL 3.5 interop tests must NOT skip on this matrix entry."
117
117
  exit 1
118
118
  fi
119
+
120
+ linux-native-backend:
121
+ needs: test
122
+ name: linux-native-backend
123
+ runs-on: ubuntu-latest
124
+ env:
125
+ PQCRYPTO_NATIVE_ASM: "1"
126
+
127
+ steps:
128
+ - name: Checkout
129
+ uses: actions/checkout@v4
130
+
131
+ - name: Set up Ruby
132
+ uses: ruby/setup-ruby@v1
133
+ with:
134
+ ruby-version: "3.4"
135
+ bundler-cache: true
136
+
137
+ - name: Verify vendored sources
138
+ run: bundle exec rake vendor:verify
139
+
140
+ - name: Compile extension with native x86_64 backend
141
+ run: |
142
+ rm -rf tmp lib/pqcrypto/pqcrypto_secure.so
143
+ bundle exec rake compile
144
+
145
+ - name: Smoke native backend
146
+ run: |
147
+ bundle exec ruby -Ilib -e '
148
+ require "pq_crypto"
149
+
150
+ kem = PQCrypto::KEM.generate(:ml_kem_768)
151
+ enc = kem.public_key.encapsulate
152
+ raise "ML-KEM mismatch" unless kem.secret_key.decapsulate(enc.ciphertext) == enc.shared_secret
153
+
154
+ sig = PQCrypto::Signature.generate(:ml_dsa_65)
155
+ msg = "linux-native-backend".b
156
+ signature = sig.secret_key.sign(msg)
157
+ raise "ML-DSA verify failed" unless sig.public_key.verify(msg, signature)
158
+ '
159
+
160
+ - name: Verify AVX2 native symbols
161
+ run: |
162
+ set -euxo pipefail
163
+ so="lib/pqcrypto/pqcrypto_secure.so"
164
+ test -f "$so"
165
+ nm "$so" | grep -E "pqcr_(mlkem|mldsa).*avx2|keccak.*avx2"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.3] - 2026-05-08
4
+
5
+ ### Compatibility
6
+
7
+ - Lowered the minimum supported Ruby version from `>= 3.4.0` to `>= 3.1`.
8
+ - Kept the Ruby 3.4+ optimized `rb_nogvl(..., RB_NOGVL_OFFLOAD_SAFE)` path intact.
9
+ - Added explicit native build probes for `ruby/thread.h`, `rb_thread_call_without_gvl`, and `rb_nogvl`.
10
+ - Ruby 3.1-3.3 now build the same selected `rb_nogvl` calls with a local `PQ_RB_NOGVL_OFFLOAD_SAFE` fallback of `0`, preserving ordinary no-GVL behavior without claiming scheduler offload guarantees.
11
+
12
+ ### CI
13
+
14
+ - Added Ruby 3.1-3.3 compatibility coverage as compile + smoke checks while keeping full test coverage on Ruby 3.4 and 4.0.
15
+ - Scoped the strict Async/Fiber Scheduler integration assertion to Ruby 3.4+ so compatibility runtimes do not claim `RB_NOGVL_OFFLOAD_SAFE` behavior.
16
+ - Pinned the test-only `async` dependency to the Ruby 3.1-compatible `2.21.x` line, which still contains the worker-pool support needed for the Ruby 3.4+ offload test.
17
+
18
+ ### Documentation
19
+
20
+ - Documented the Ruby 3.1+ support policy and the difference between compatibility no-GVL behavior and Ruby 3.4+ scheduler-aware offload.
21
+
22
+ ## [0.5.2] - 2026-05-06
23
+
24
+ ### Build
25
+
26
+ - Added Linux/OpenSSL discovery via `OPENSSL_ROOT_DIR`, `OPENSSL_DIR`, and `pkg-config`.
27
+ - Preserved `$(CFLAGS)`/`$(CCDLFLAGS)` for vendored native objects so Linux shared-object builds keep `-fPIC`.
28
+ - Added opt-in Linux x86_64 native-backend support through `PQCRYPTO_NATIVE_ASM=1`.
29
+ - Added x86_64 AVX2 vendor flags for mlkem-native/mldsa-native when native backends are explicitly enabled.
30
+ - Added separate `PQCRYPTO_NATIVE_ARITH` and `PQCRYPTO_NATIVE_FIPS202` switches for native arithmetic and Keccak/FIPS202 backends.
31
+ - Kept AArch64 native asm enabled by default; verified macOS arm64 still builds ML-KEM/ML-DSA native asm paths.
32
+
33
+ ### CI
34
+
35
+ - Added a Linux native-backend job that compiles with `PQCRYPTO_NATIVE_ASM=1`, runs ML-KEM/ML-DSA smoke checks, and verifies AVX2 symbols in the extension.
36
+
3
37
  ## [0.5.1] - 2026-05-04
4
38
 
5
39
  ### Performance
data/GET_STARTED.md CHANGED
@@ -379,11 +379,15 @@ PQCRYPTO_NATIVE_ASM=1 bundle exec rake compile
379
379
 
380
380
  ## 14. Async / Fiber scheduler behavior
381
381
 
382
- On Ruby 3.4, signing and verification use Ruby's scheduler-aware
382
+ On Ruby 3.4 and later, signing and verification keep Ruby's scheduler-aware
383
383
  `rb_nogvl(..., RB_NOGVL_OFFLOAD_SAFE)` path automatically. With a scheduler
384
384
  that implements `blocking_operation_wait`, blocking native work can be moved
385
385
  off the event loop.
386
386
 
387
+ Ruby 3.1-3.3 are supported as a compatibility path: native operations still
388
+ release the GVL, but `RB_NOGVL_OFFLOAD_SAFE` is not available there, so the gem
389
+ does not claim Fiber Scheduler offload guarantees on those runtimes.
390
+
387
391
  ## 15. Test-only deterministic helpers
388
392
 
389
393
  `PQCrypto::Testing` exposes deterministic helpers for regression tests:
data/README.md CHANGED
@@ -63,7 +63,9 @@ original algorithms:
63
63
 
64
64
  ## Requirements
65
65
 
66
- - Ruby 3.4 or later
66
+ - Ruby 3.1 or later
67
+ - Ruby 3.4+ keeps the optimized Fiber Scheduler offload path via `RB_NOGVL_OFFLOAD_SAFE`
68
+ - Ruby 3.1-3.3 use the compatibility no-GVL path without scheduler offload guarantees
67
69
  - a C toolchain with C11 support
68
70
  - OpenSSL 3.0 or later with SHA3-256 and SHAKE256 available
69
71
  - vendored minimal PQ Code Package native snapshot in `ext/pqcrypto/vendor`
@@ -39,32 +39,31 @@ if SANITIZE && !SANITIZE.strip.empty?
39
39
  $LDFLAGS << " -fsanitize=#{sanitize}"
40
40
  end
41
41
 
42
- def native_asm_supported_by_default?
43
- host_cpu = RbConfig::CONFIG.fetch("host_cpu", "")
44
- host_os = RbConfig::CONFIG.fetch("host_os", "")
45
- return false if host_os =~ /mswin|mingw|cygwin/i
42
+ def host_cpu
43
+ RbConfig::CONFIG.fetch("host_cpu", "")
44
+ end
46
45
 
47
- host_cpu =~ /\A(?:arm64|aarch64)\z/i
46
+ def host_os
47
+ RbConfig::CONFIG.fetch("host_os", "")
48
48
  end
49
49
 
50
- def parse_native_asm_env(value)
51
- return native_asm_supported_by_default? if value.nil? || value.strip.empty? || value == "auto"
50
+ def aarch64_host?
51
+ host_cpu =~ /\A(?:arm64|aarch64)\z/i
52
+ end
52
53
 
53
- case value.strip.downcase
54
- when "1", "true", "yes", "on", "auto"
55
- true
56
- when "0", "false", "no", "off"
57
- false
58
- else
59
- abort "Invalid PQCRYPTO_NATIVE_ASM=#{value.inspect}; use 1, 0, or auto"
60
- end
54
+ def x86_64_host?
55
+ host_cpu =~ /\A(?:x86_64|amd64|x64)\z/i
61
56
  end
62
57
 
63
- NATIVE_ASM = parse_native_asm_env(ENV["PQCRYPTO_NATIVE_ASM"])
58
+ def native_asm_supported_by_default?
59
+ return false if host_os =~ /mswin|mingw|cygwin/i
64
60
 
65
- def parse_native_backend_env(name)
61
+ aarch64_host?
62
+ end
63
+
64
+ def env_bool(name, default)
66
65
  value = ENV[name]
67
- return NATIVE_ASM if value.nil? || value.strip.empty? || value == "auto"
66
+ return default if value.nil? || value.strip.empty? || value.strip.downcase == "auto"
68
67
 
69
68
  case value.strip.downcase
70
69
  when "1", "true", "yes", "on"
@@ -72,19 +71,53 @@ def parse_native_backend_env(name)
72
71
  when "0", "false", "no", "off"
73
72
  false
74
73
  else
75
- abort "Invalid #{name}=#{value.inspect}; use 1, 0, or auto"
74
+ abort "Invalid #{name}=#{value.inspect}; use 1, 0, true, false, or auto"
76
75
  end
77
76
  end
78
77
 
79
- NATIVE_ARITH = parse_native_backend_env("PQCRYPTO_NATIVE_ARITH")
80
- NATIVE_FIPS202 = parse_native_backend_env("PQCRYPTO_NATIVE_FIPS202")
78
+ NATIVE_ASM = env_bool("PQCRYPTO_NATIVE_ASM", native_asm_supported_by_default?)
79
+ NATIVE_ARITH = env_bool("PQCRYPTO_NATIVE_ARITH", NATIVE_ASM)
80
+ NATIVE_FIPS202 = env_bool("PQCRYPTO_NATIVE_FIPS202", NATIVE_ASM)
81
+
82
+ X86_VENDOR_ARCH_FLAGS = "-mavx2 -mbmi -mbmi2 -mpopcnt -maes -mssse3 -msse4.1 -msse4.2"
83
+
84
+ VENDOR_C_ARCH_FLAGS = +""
85
+ VENDOR_ASM_ARCH_FLAGS = +""
86
+
87
+ if x86_64_host? && (NATIVE_ARITH || NATIVE_FIPS202)
88
+ VENDOR_C_ARCH_FLAGS << "#{X86_VENDOR_ARCH_FLAGS} -fno-tree-vectorize"
89
+ VENDOR_ASM_ARCH_FLAGS << X86_VENDOR_ARCH_FLAGS
90
+ end
91
+
92
+ if ENV["PQCRYPTO_NATIVE_TUNE"] == "1"
93
+ VENDOR_C_ARCH_FLAGS << " -march=native -mtune=native"
94
+ VENDOR_ASM_ARCH_FLAGS << " -march=native -mtune=native"
95
+ end
81
96
 
82
97
  def configure_compiler_environment
83
- return unless RUBY_PLATFORM.include?("darwin")
98
+ if RUBY_PLATFORM.include?("darwin")
99
+ dir_config("homebrew", "/opt/homebrew")
100
+ $CPPFLAGS << " -I/opt/homebrew/include"
101
+ $LDFLAGS << " -L/opt/homebrew/lib"
102
+ return
103
+ end
104
+
105
+ openssl_root = ENV["OPENSSL_ROOT_DIR"] || ENV["OPENSSL_DIR"]
106
+ if openssl_root && !openssl_root.strip.empty? && File.directory?(openssl_root)
107
+ $CPPFLAGS << " -I#{openssl_root}/include"
108
+ %w[lib64 lib].each do |suffix|
109
+ libdir = File.join(openssl_root, suffix)
110
+ next unless File.directory?(libdir)
84
111
 
85
- dir_config("homebrew", "/opt/homebrew")
86
- $CPPFLAGS << " -I/opt/homebrew/include"
87
- $LDFLAGS << " -L/opt/homebrew/lib"
112
+ $LDFLAGS << " -L#{libdir} -Wl,-rpath,#{libdir}"
113
+ break
114
+ end
115
+ elsif find_executable("pkg-config")
116
+ cflags = `pkg-config --cflags openssl 2>/dev/null`.strip
117
+ libs = `pkg-config --libs-only-L openssl 2>/dev/null`.strip
118
+ $CPPFLAGS << " #{cflags}" unless cflags.empty?
119
+ $LDFLAGS << " #{libs}" unless libs.empty?
120
+ end
88
121
  end
89
122
 
90
123
  def native_vendor_sources_for(vendor_dir)
@@ -154,6 +187,12 @@ def find_vendor_dir
154
187
  candidates.find { |path| native_vendor_ready?(path) }
155
188
  end
156
189
 
190
+ def configure_ruby_c_api!
191
+ abort "ruby/thread.h is required" unless have_header("ruby/thread.h")
192
+ abort "rb_thread_call_without_gvl is required" unless have_func("rb_thread_call_without_gvl", "ruby/thread.h")
193
+ abort "rb_nogvl is required" unless have_func("rb_nogvl", "ruby/thread.h")
194
+ end
195
+
157
196
  def configure_openssl!
158
197
  configure_compiler_environment
159
198
 
@@ -270,7 +309,7 @@ def inject_native_sources!(config)
270
309
  build_rules << <<~RULE
271
310
  #{object}: #{source}
272
311
  $(ECHO) compiling #{source} [#{kind}-#{level}]
273
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) #{VENDOR_ONLY_CFLAGS} #{flags} $(COUTFLAG)$@ -c $(CSRCFLAG)$<
312
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(CCDLFLAGS) #{VENDOR_ONLY_CFLAGS} #{VENDOR_C_ARCH_FLAGS} #{flags} $(COUTFLAG)$@ -c $(CSRCFLAG)$<
274
313
  RULE
275
314
  end
276
315
 
@@ -291,7 +330,7 @@ def inject_native_sources!(config)
291
330
  build_rules << <<~RULE
292
331
  #{object}: #{source}
293
332
  $(ECHO) assembling #{source} [#{kind}-#{level}]
294
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) #{VENDOR_ONLY_CFLAGS} #{flags} $(COUTFLAG)$@ -c $(CSRCFLAG)$<
333
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(CCDLFLAGS) #{VENDOR_ONLY_CFLAGS} #{VENDOR_ASM_ARCH_FLAGS} #{flags} $(COUTFLAG)$@ -c $(CSRCFLAG)$<
295
334
  RULE
296
335
  end
297
336
  end
@@ -316,14 +355,21 @@ vendor_dir = find_vendor_dir
316
355
 
317
356
  puts
318
357
  puts "=== PQCrypto build configuration ==="
358
+ configure_ruby_c_api!
319
359
  configure_openssl!
320
360
  native_config = native_vendor_config(vendor_dir)
321
361
  puts "OpenSSL: system"
322
362
  puts "ML-KEM: mlkem-native vendored"
323
363
  puts "ML-DSA: mldsa-native vendored"
364
+ puts "Host CPU: #{host_cpu} (#{host_os})"
324
365
  puts "Native asm auto/forced: #{NATIVE_ASM ? 'enabled' : 'disabled'}"
325
366
  puts "Native arithmetic backend: #{NATIVE_ARITH ? 'enabled' : 'disabled'}"
326
367
  puts "Native FIPS202 backend: #{NATIVE_FIPS202 ? 'enabled' : 'disabled'}"
368
+ puts "Vendor C arch flags: #{VENDOR_C_ARCH_FLAGS.empty? ? '(none)' : VENDOR_C_ARCH_FLAGS}"
369
+ puts "Vendor ASM arch flags: #{VENDOR_ASM_ARCH_FLAGS.empty? ? '(none)' : VENDOR_ASM_ARCH_FLAGS}"
370
+ if x86_64_host? && (NATIVE_ARITH || NATIVE_FIPS202)
371
+ puts "x86_64 native backend: AVX2 build flags enabled"
372
+ end
327
373
  puts "PQClean fallback: removed"
328
374
  puts "Output: pqcrypto/pqcrypto_secure"
329
375
  puts "===================================="
@@ -1,6 +1,13 @@
1
+ #if defined(__clang__) || defined(__GNUC__)
2
+ #pragma GCC diagnostic push
3
+ #pragma GCC diagnostic ignored "-Wunused-parameter"
4
+ #endif
1
5
  #include <ruby.h>
2
6
  #include <ruby/thread.h>
3
7
  #include <ruby/encoding.h>
8
+ #if defined(__clang__) || defined(__GNUC__)
9
+ #pragma GCC diagnostic pop
10
+ #endif
4
11
  #include <stdlib.h>
5
12
  #include <string.h>
6
13
 
@@ -10,7 +17,9 @@
10
17
  #include "pqcrypto_secure.h"
11
18
 
12
19
  #ifndef RB_NOGVL_OFFLOAD_SAFE
13
- #define RB_NOGVL_OFFLOAD_SAFE 0
20
+ #define PQ_RB_NOGVL_OFFLOAD_SAFE 0
21
+ #else
22
+ #define PQ_RB_NOGVL_OFFLOAD_SAFE RB_NOGVL_OFFLOAD_SAFE
14
23
  #endif
15
24
 
16
25
  #define PQ_MU_ABSORB_NOGVL_MIN_BYTES 16384
@@ -154,8 +163,8 @@ static void pq_init_algorithm_ids(void) {
154
163
  static const char *pq_algorithm_symbol_to_cstr(VALUE algorithm) {
155
164
  if (SYMBOL_P(algorithm)) {
156
165
  ID id = SYM2ID(algorithm);
157
- for (size_t i = 0; i < sizeof(PQC_CONTAINER_ALGORITHMS) / sizeof(PQC_CONTAINER_ALGORITHMS[0]);
158
- ++i) {
166
+ for (size_t i = 0;
167
+ i < sizeof(PQC_CONTAINER_ALGORITHMS) / sizeof(PQC_CONTAINER_ALGORITHMS[0]); ++i) {
159
168
  if (id == pqc_container_algorithm_ids[i]) {
160
169
  return PQC_CONTAINER_ALGORITHMS[i];
161
170
  }
@@ -164,8 +173,8 @@ static const char *pq_algorithm_symbol_to_cstr(VALUE algorithm) {
164
173
  VALUE str = StringValue(algorithm);
165
174
  const char *ptr = RSTRING_PTR(str);
166
175
  size_t len = (size_t)RSTRING_LEN(str);
167
- for (size_t i = 0; i < sizeof(PQC_CONTAINER_ALGORITHMS) / sizeof(PQC_CONTAINER_ALGORITHMS[0]);
168
- ++i) {
176
+ for (size_t i = 0;
177
+ i < sizeof(PQC_CONTAINER_ALGORITHMS) / sizeof(PQC_CONTAINER_ALGORITHMS[0]); ++i) {
169
178
  size_t algorithm_len = strlen(PQC_CONTAINER_ALGORITHMS[i]);
170
179
  if (len == algorithm_len && memcmp(ptr, PQC_CONTAINER_ALGORITHMS[i], len) == 0) {
171
180
  return PQC_CONTAINER_ALGORITHMS[i];
@@ -272,16 +281,16 @@ static void *pq_hybrid_kem_decapsulate_nogvl(void *arg) {
272
281
 
273
282
  static void *pq_hybrid_kem_decapsulate_expanded_nogvl(void *arg) {
274
283
  kem_decapsulate_call_t *call = (kem_decapsulate_call_t *)arg;
275
- call->result = pq_hybrid_kem_decapsulate_expanded(call->shared_secret, call->ciphertext,
276
- call->secret_key);
284
+ call->result =
285
+ pq_hybrid_kem_decapsulate_expanded(call->shared_secret, call->ciphertext, call->secret_key);
277
286
  return NULL;
278
287
  }
279
288
 
280
289
  static void *pq_hybrid_kem_decapsulate_expanded_pkey_nogvl(void *arg) {
281
- hybrid_decapsulate_expanded_pkey_call_t *call =
282
- (hybrid_decapsulate_expanded_pkey_call_t *)arg;
283
- call->result = pq_hybrid_kem_decapsulate_expanded_pkey(
284
- call->shared_secret, call->ciphertext, call->expanded_secret_key, call->x25519_private_pkey);
290
+ hybrid_decapsulate_expanded_pkey_call_t *call = (hybrid_decapsulate_expanded_pkey_call_t *)arg;
291
+ call->result = pq_hybrid_kem_decapsulate_expanded_pkey(call->shared_secret, call->ciphertext,
292
+ call->expanded_secret_key,
293
+ call->x25519_private_pkey);
285
294
  return NULL;
286
295
  }
287
296
 
@@ -815,12 +824,11 @@ static VALUE pqcrypto_hybrid_kem_decapsulate_expanded(VALUE self, VALUE cipherte
815
824
  (void)self;
816
825
  return pq_run_kem_decapsulate(pq_hybrid_kem_decapsulate_expanded_nogvl, ciphertext,
817
826
  PQ_HYBRID_CIPHERTEXTBYTES, expanded_secret_key,
818
- PQ_HYBRID_EXPANDED_SECRETKEYBYTES,
819
- PQ_HYBRID_SHAREDSECRETBYTES);
827
+ PQ_HYBRID_EXPANDED_SECRETKEYBYTES, PQ_HYBRID_SHAREDSECRETBYTES);
820
828
  }
821
829
 
822
830
  static VALUE pqcrypto_hybrid_kem_decapsulate_expanded_object(VALUE self, VALUE ciphertext,
823
- VALUE expanded_secret_key_obj) {
831
+ VALUE expanded_secret_key_obj) {
824
832
  (void)self;
825
833
  hybrid_expanded_key_wrapper_t *wrapper = hybrid_expanded_key_unwrap(expanded_secret_key_obj);
826
834
  hybrid_decapsulate_expanded_pkey_call_t call = {0};
@@ -1184,7 +1192,7 @@ static VALUE pq_run_sign(void *(*nogvl)(void *), VALUE message, VALUE secret_key
1184
1192
  call.signature = pq_alloc_buffer(signature_len_expected);
1185
1193
  call.message = pq_copy_ruby_string(message, &call.message_len);
1186
1194
 
1187
- rb_nogvl(nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1195
+ rb_nogvl(nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1188
1196
 
1189
1197
  pq_free_buffer(call.message);
1190
1198
  pq_wipe_and_free((uint8_t *)call.secret_key, secret_key_len);
@@ -1224,7 +1232,7 @@ static VALUE pq_run_verify(void *(*nogvl)(void *), VALUE message, VALUE signatur
1224
1232
  call.signature_len = signature_len;
1225
1233
  call.message = pq_copy_ruby_string(message, &call.message_len);
1226
1234
 
1227
- rb_nogvl(nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1235
+ rb_nogvl(nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1228
1236
 
1229
1237
  pq_free_buffer(call.message);
1230
1238
  pq_free_buffer((uint8_t *)call.public_key);
@@ -1428,8 +1436,8 @@ static VALUE pqcrypto__native_mldsa_mu_builder_update(VALUE self, VALUE builder_
1428
1436
  }
1429
1437
 
1430
1438
  if (chunk_len < PQ_MU_ABSORB_NOGVL_MIN_BYTES) {
1431
- int rc = pq_mu_builder_absorb(wrapper->builder, (const uint8_t *)RSTRING_PTR(chunk),
1432
- chunk_len);
1439
+ int rc =
1440
+ pq_mu_builder_absorb(wrapper->builder, (const uint8_t *)RSTRING_PTR(chunk), chunk_len);
1433
1441
  if (rc != PQ_SUCCESS) {
1434
1442
  pq_raise_general_error(rc);
1435
1443
  }
@@ -1444,7 +1452,7 @@ static VALUE pqcrypto__native_mldsa_mu_builder_update(VALUE self, VALUE builder_
1444
1452
  call.chunk = copy;
1445
1453
  call.chunk_len = chunk_len;
1446
1454
 
1447
- rb_nogvl(pq_mu_absorb_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1455
+ rb_nogvl(pq_mu_absorb_nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1448
1456
  free(copy);
1449
1457
 
1450
1458
  if (call.result != PQ_SUCCESS) {
@@ -1469,7 +1477,7 @@ static VALUE pqcrypto__native_mldsa_mu_builder_finalize(VALUE self, VALUE builde
1469
1477
  call.builder = wrapper->builder;
1470
1478
  call.mu_out = mu;
1471
1479
 
1472
- rb_nogvl(pq_mu_finalize_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1480
+ rb_nogvl(pq_mu_finalize_nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1473
1481
 
1474
1482
  wrapper->builder = NULL;
1475
1483
 
@@ -1516,7 +1524,7 @@ static VALUE pqcrypto__native_mldsa_sign_mu(VALUE self, VALUE mu, VALUE secret_k
1516
1524
  call.signature_len = PQ_MLDSA_BYTES;
1517
1525
  call.signature = pq_alloc_buffer(PQ_MLDSA_BYTES);
1518
1526
 
1519
- rb_nogvl(pq_sign_mu_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1527
+ rb_nogvl(pq_sign_mu_nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1520
1528
 
1521
1529
  pq_wipe_and_free(mu_copy, mu_len);
1522
1530
  pq_wipe_and_free(sk_copy, secret_key_len);
@@ -1557,7 +1565,7 @@ static VALUE pqcrypto__native_mldsa_verify_mu(VALUE self, VALUE mu, VALUE signat
1557
1565
  call.signature = sig_copy;
1558
1566
  call.signature_len = signature_len;
1559
1567
 
1560
- rb_nogvl(pq_verify_mu_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1568
+ rb_nogvl(pq_verify_mu_nogvl, &call, NULL, NULL, PQ_RB_NOGVL_OFFLOAD_SAFE);
1561
1569
  pq_wipe_and_free(mu_copy, mu_len);
1562
1570
  pq_free_buffer(pk_copy);
1563
1571
  pq_free_buffer(sig_copy);
@@ -2,6 +2,6 @@
2
2
  #ifndef PQCRYPTO_VERSION_H
3
3
  #define PQCRYPTO_VERSION_H
4
4
 
5
- #define PQCRYPTO_VERSION "0.5.1"
5
+ #define PQCRYPTO_VERSION "0.5.3"
6
6
 
7
7
  #endif
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PQCrypto
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pq_crypto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Haydarov
@@ -335,7 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
335
335
  requirements:
336
336
  - - ">="
337
337
  - !ruby/object:Gem::Version
338
- version: 3.4.0
338
+ version: '3.1'
339
339
  required_rubygems_version: !ruby/object:Gem::Requirement
340
340
  requirements:
341
341
  - - ">="