digest 3.1.0.pre3 → 3.1.1

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: a901be021123562b80812ad783e1e6cb9d44a3d3082b38304860722b1de65b8d
4
- data.tar.gz: d22dfd3515b87aa626b52a096240fab8ebe635eb0ee43edc1ce595c6ae6901a8
3
+ metadata.gz: 987de45a2894fa80f0d6ff23f3a70a7e813b9529b5ef4130b22be5e4c2f78020
4
+ data.tar.gz: 7241f2a350845b1478666dfbb0d6662a1b61e41a16e7504b064dd6eca6e3c0b2
5
5
  SHA512:
6
- metadata.gz: 4f06a8c82073b0ae69a6f6a0292a92bcca0e13af7f751cc98471769c71efcd5f5cd2cfa45ad9b3b7d1b574b7ce7b442ee85f75391de1376f9180499dd682c002
7
- data.tar.gz: 3a53dbbcd44edacf5ea23a326a27474715693ea6064d9ed5211790fcf2af12669a9115219cf8cd83bda99d5a0c4790bd9d7a9062b4b3f29de0e4b3c2bc15f16d
6
+ metadata.gz: b1f322b8fed96de4cde9b2b8cd2997f99a80998b5b671924cb6f3e3b6b28215c95021f2919ef8a5176823639e56ddb3cd05e2a154c59d9945f4770138ae4d941
7
+ data.tar.gz: f2a9f6d45f28fe9be2d140d9f99147669f9a0ab32fbeac724254eca036a89a364f222beac6eb3b38def4f395f961dc646a7780344e7eb13eff0759a39b7c6ce7
@@ -37,7 +37,7 @@ bubblebabble_str_new(VALUE str_digest)
37
37
  digest_len = RSTRING_LEN(str_digest);
38
38
 
39
39
  if ((LONG_MAX - 2) / 3 < (digest_len | 1)) {
40
- rb_raise(rb_eRuntimeError, "digest string too long");
40
+ rb_raise(rb_eRuntimeError, "digest string too long");
41
41
  }
42
42
 
43
43
  str = rb_str_new(0, (digest_len | 1) * 3 + 2);
data/ext/digest/digest.c CHANGED
@@ -154,7 +154,7 @@ static void
154
154
  rb_digest_instance_method_unimpl(VALUE self, const char *method)
155
155
  {
156
156
  rb_raise(rb_eRuntimeError, "%s does not implement %s()",
157
- rb_obj_classname(self), method);
157
+ rb_obj_classname(self), method);
158
158
  }
159
159
 
160
160
  /*
@@ -383,8 +383,8 @@ rb_digest_instance_equal(VALUE self, VALUE other)
383
383
  StringValue(str2);
384
384
 
385
385
  if (RSTRING_LEN(str1) == RSTRING_LEN(str2) &&
386
- rb_str_cmp(str1, str2) == 0) {
387
- return Qtrue;
386
+ rb_str_cmp(str1, str2) == 0) {
387
+ return Qtrue;
388
388
  }
389
389
  return Qfalse;
390
390
  }
@@ -602,7 +602,7 @@ static inline void
602
602
  algo_init(const rb_digest_metadata_t *algo, void *pctx)
603
603
  {
604
604
  if (algo->init_func(pctx) != 1) {
605
- rb_raise(rb_eRuntimeError, "Digest initialization failed.");
605
+ rb_raise(rb_eRuntimeError, "Digest initialization failed.");
606
606
  }
607
607
  }
608
608
 
@@ -614,7 +614,7 @@ rb_digest_base_alloc(VALUE klass)
614
614
  void *pctx;
615
615
 
616
616
  if (klass == rb_cDigest_Base) {
617
- rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
617
+ rb_raise(rb_eNotImpError, "Digest::Base is an abstract class");
618
618
  }
619
619
 
620
620
  algo = get_digest_base_metadata(klass);
@@ -639,7 +639,7 @@ rb_digest_base_copy(VALUE copy, VALUE obj)
639
639
 
640
640
  algo = get_digest_obj_metadata(copy);
641
641
  if (algo != get_digest_obj_metadata(obj))
642
- rb_raise(rb_eTypeError, "different algorithms");
642
+ rb_raise(rb_eTypeError, "different algorithms");
643
643
 
644
644
  TypedData_Get_Struct(obj, void, &digest_type, pctx1);
645
645
  TypedData_Get_Struct(copy, void, &digest_type, pctx2);
data/ext/digest/digest.h CHANGED
@@ -38,7 +38,7 @@ rb_digest_##name##_update(void *ctx, unsigned char *ptr, size_t size) \
38
38
  const unsigned int stride = 16384; \
39
39
  \
40
40
  for (; size > stride; size -= stride, ptr += stride) { \
41
- name##_Update(ctx, ptr, stride); \
41
+ name##_Update(ctx, ptr, stride); \
42
42
  } \
43
43
  if (size > 0) name##_Update(ctx, ptr, size); \
44
44
  }
@@ -3,7 +3,7 @@
3
3
  def digest_conf(name)
4
4
  unless with_config("bundled-#{name}")
5
5
  cc = with_config("common-digest")
6
- if cc == true or /\b#{name}\b/ =~ cc
6
+ if cc != false or /\b#{name}\b/ =~ cc
7
7
  if File.exist?("#$srcdir/#{name}cc.h") and
8
8
  have_header("CommonCrypto/CommonDigest.h")
9
9
  $defs << "-D#{name.upcase}_USE_COMMONDIGEST"
@@ -4,4 +4,8 @@
4
4
 
5
5
  require "mkmf"
6
6
 
7
+ $INSTALLFILES = {
8
+ "digest.h" => "$(HDRDIR)"
9
+ } if $extmk
10
+
7
11
  create_makefile("digest")
@@ -128,7 +128,7 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
128
128
  #define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16)
129
129
 
130
130
 
131
- #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(__GNUC__) || defined(_HPUX_SOURCE) || defined(__IBMC__)
131
+ #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(__GNUC__) || defined(__IBMC__)
132
132
  #define ULL(number) number##ULL
133
133
  #else
134
134
  #define ULL(number) (uint64_t)(number)
@@ -47,7 +47,7 @@ Init_sha2(void)
47
47
  cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \
48
48
  \
49
49
  rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \
50
- rb_digest_make_metadata(&sha##bitlen));
50
+ rb_digest_make_metadata(&sha##bitlen));
51
51
 
52
52
  FOREACH_BITLEN(DEFINE_ALGO_CLASS)
53
53
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Digest
4
- VERSION = "3.1.0.pre3"
4
+ VERSION = "3.1.1"
5
5
  end
data/lib/digest.rb CHANGED
@@ -1,25 +1,23 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- # The gem and bundle commands (except for bundle exec) first load
4
- # digest via openssl and then load gems, so if this is installed via
5
- # gem, we are overwriting the default version of digest. Beware not
6
- # to break it or cause redefinition warnings.
7
- #
8
- # When we introduce incompatible changes and overwriting is not an
9
- # option, and given that the default version does not have security
10
- # defects, we may just give up and let those commands just use the
11
- # default version of digest.
12
- #
13
- # return if defined?(Digest) && caller_locations.any? { |l|
14
- # %r{/(rubygems/gem_runner|bundler/cli)\.rb}.match?(l.path)
15
- # }
3
+ if defined?(Digest) &&
4
+ /\A(?:2\.|3\.0\.[0-2]\z)/.match?(RUBY_VERSION) &&
5
+ caller_locations.any? { |l|
6
+ %r{/(rubygems/gem_runner|bundler/cli)\.rb}.match?(l.path)
7
+ }
8
+ # Before Ruby 3.0.3/3.1.0, the gem and bundle commands used to load
9
+ # the digest library before loading additionally installed gems, so
10
+ # you will get constant redefinition warnings and unexpected
11
+ # implementation overwriting if we proceed here. Avoid that.
12
+ return
13
+ end
16
14
 
17
15
  require 'digest/version'
18
16
  require 'digest/loader'
19
17
 
20
18
  module Digest
21
19
  # A mutex for Digest().
22
- REQUIRE_MUTEX ||= Thread::Mutex.new
20
+ REQUIRE_MUTEX = Thread::Mutex.new
23
21
 
24
22
  def self.const_missing(name) # :nodoc:
25
23
  case name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digest
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.pre3
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-24 00:00:00.000000000 Z
11
+ date: 2022-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides a framework for message digest libraries.
14
14
  email:
@@ -28,12 +28,10 @@ files:
28
28
  - ext/digest/bubblebabble/bubblebabble.c
29
29
  - ext/digest/bubblebabble/extconf.rb
30
30
  - ext/digest/defs.h
31
- - ext/digest/depend
32
31
  - ext/digest/digest.c
33
32
  - ext/digest/digest.h
34
33
  - ext/digest/digest_conf.rb
35
34
  - ext/digest/extconf.rb
36
- - ext/digest/install_headers.rb
37
35
  - ext/digest/lib/digest/loader.rb
38
36
  - ext/digest/lib/digest/sha2/loader.rb
39
37
  - ext/digest/md5/extconf.rb
@@ -76,11 +74,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
74
  version: 2.5.0
77
75
  required_rubygems_version: !ruby/object:Gem::Requirement
78
76
  requirements:
79
- - - ">"
77
+ - - ">="
80
78
  - !ruby/object:Gem::Version
81
- version: 1.3.1
79
+ version: '0'
82
80
  requirements: []
83
- rubygems_version: 3.2.22
81
+ rubygems_version: 3.4.0.dev
84
82
  signing_key:
85
83
  specification_version: 4
86
84
  summary: Provides a framework for message digest libraries.
data/ext/digest/depend DELETED
@@ -1,3 +0,0 @@
1
- do-install-rb: do-install-headers
2
- do-install-headers:
3
- $(Q) $(RUBY) install_headers.rb $(srcdir)/digest.h $(DESTDIR)$(HDRDIR)
@@ -1,13 +0,0 @@
1
- require "fileutils"
2
-
3
- *files, dest = ARGV
4
-
5
- if File.exist?(File.join(dest, "ruby.h"))
6
- warn "installing header files"
7
-
8
- files.each { |file|
9
- FileUtils.install file, dest, mode: 0644, verbose: true
10
- }
11
- else
12
- warn "not installing header files when installed as an external library"
13
- end