Nautilus-Institute / quals-2022

Source code for the 2022 DEF CON Qualifiers.
MIT License
264 stars 26 forks source link

cryptochall: clobbered header file & empty Makefile #1

Closed bdlmt closed 2 years ago

bdlmt commented 2 years ago

Makefile in quals-2022/cryptochall/challenge/ is empty

bdlmt commented 2 years ago

g++ -o cryptochall main.cpp has compile time errors. Unsure what the build requirements are 😢

$ g++ -o cryptochall main.cpp
In file included from main.cpp:2:
rot13.h:7:29: error: expected class-name before ‘{’ token
    7 | class ROT13 : public Caesar {
      |                             ^
rot13.h: In constructor ‘ROT13::ROT13()’:
rot13.h:11:7: error: ‘key1_’ was not declared in this scope
   11 |       key1_ = make_shared<BigInt>(14);
      |       ^~~~~
rot13.h:12:7: error: ‘key2_’ was not declared in this scope
   12 |       key2_ = make_shared<BigInt>(12);
      |       ^~~~~
main.cpp: In function ‘int main()’:
main.cpp:47:40: error: no match for ‘operator=’ (operand types are ‘std::shared_ptr<Cipher>’ and ‘std::shared_ptr<ROT13>’)
   47 |         newCipher = make_shared<ROT13>();
      |                                        ^
In file included from /usr/include/c++/11/memory:77,
                 from mes.h:4,
                 from main.cpp:1:
/usr/include/c++/11/bits/shared_ptr.h:363:9: note: candidate: ‘template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Yp = _Yp; _Tp = Cipher]’
  363 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:363:9: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/shared_ptr.h: In substitution of ‘template<class _Tp> template<class _Arg> using _Assignable = typename std::enable_if<std::is_assignable<std::__shared_ptr<_Tp>&, _Arg>::value, std::shared_ptr<_Tp>&>::type [with _Arg = const std::shared_ptr<ROT13>&; _Tp = Cipher]’:
/usr/include/c++/11/bits/shared_ptr.h:363:2:   required by substitution of ‘template<class _Yp> std::shared_ptr<Cipher>::_Assignable<const std::shared_ptr<_Tp>&> std::shared_ptr<Cipher>::operator=<_Yp>(const std::shared_ptr<_Tp>&) [with _Yp = ROT13]’
main.cpp:47:40:   required from here
/usr/include/c++/11/bits/shared_ptr.h:130:15: error: no type named ‘type’ in ‘struct std::enable_if<false, std::shared_ptr<Cipher>&>’
  130 |         using _Assignable = typename enable_if<
      |               ^~~~~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:374:9: note: candidate: ‘template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::auto_ptr<_Up> > std::shared_ptr<_Tp>::operator=(std::auto_ptr<_Up>&&) [with _Yp = _Yp; _Tp = Cipher]’
  374 |         operator=(auto_ptr<_Yp>&& __r)
      |         ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:374:9: note:   template argument deduction/substitution failed:
main.cpp:47:40: note:   ‘std::shared_ptr<ROT13>’ is not derived from ‘std::auto_ptr<_Up>’
   47 |         newCipher = make_shared<ROT13>();
      |                                        ^
In file included from /usr/include/c++/11/memory:77,
                 from mes.h:4,
                 from main.cpp:1:
/usr/include/c++/11/bits/shared_ptr.h:391:9: note: candidate: ‘template<class _Yp> std::shared_ptr<_Tp>::_Assignable<std::shared_ptr<_Yp> > std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Yp>&&) [with _Yp = _Yp; _Tp = Cipher]’
  391 |         operator=(shared_ptr<_Yp>&& __r) noexcept
      |         ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:391:9: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/shared_ptr.h: In substitution of ‘template<class _Tp> template<class _Arg> using _Assignable = typename std::enable_if<std::is_assignable<std::__shared_ptr<_Tp>&, _Arg>::value, std::shared_ptr<_Tp>&>::type [with _Arg = std::shared_ptr<ROT13>; _Tp = Cipher]’:
/usr/include/c++/11/bits/shared_ptr.h:391:2:   required by substitution of ‘template<class _Yp> std::shared_ptr<Cipher>::_Assignable<std::shared_ptr<_Tp> > std::shared_ptr<Cipher>::operator=<_Yp>(std::shared_ptr<_Tp>&&) [with _Yp = ROT13]’
main.cpp:47:40:   required from here
/usr/include/c++/11/bits/shared_ptr.h:130:15: error: no type named ‘type’ in ‘struct std::enable_if<false, std::shared_ptr<Cipher>&>’
  130 |         using _Assignable = typename enable_if<
      |               ^~~~~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:399:9: note: candidate: ‘template<class _Yp, class _Del> std::shared_ptr<_Tp>::_Assignable<std::unique_ptr<_Up, _Ep> > std::shared_ptr<_Tp>::operator=(std::unique_ptr<_Up, _Ep>&&) [with _Yp = _Yp; _Del = _Del; _Tp = Cipher]’
  399 |         operator=(unique_ptr<_Yp, _Del>&& __r)
      |         ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:399:9: note:   template argument deduction/substitution failed:
main.cpp:47:40: note:   ‘std::shared_ptr<ROT13>’ is not derived from ‘std::unique_ptr<_Tp, _Dp>’
   47 |         newCipher = make_shared<ROT13>();
      |                                        ^
In file included from /usr/include/c++/11/memory:77,
                 from mes.h:4,
                 from main.cpp:1:
/usr/include/c++/11/bits/shared_ptr.h:359:19: note: candidate: ‘std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Tp>&) [with _Tp = Cipher]’
  359 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                   ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:359:29: note:   no known conversion for argument 1 from ‘std::shared_ptr<ROT13>’ to ‘const std::shared_ptr<Cipher>&’
  359 |       shared_ptr& operator=(const shared_ptr&) noexcept = default;
      |                             ^~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:383:7: note: candidate: ‘std::shared_ptr<_Tp>& std::shared_ptr<_Tp>::operator=(std::shared_ptr<_Tp>&&) [with _Tp = Cipher]’
  383 |       operator=(shared_ptr&& __r) noexcept
      |       ^~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:383:30: note:   no known conversion for argument 1 from ‘std::shared_ptr<ROT13>’ to ‘std::shared_ptr<Cipher>&&’
  383 |       operator=(shared_ptr&& __r) noexcept
      |                 ~~~~~~~~~~~~~^~~
main.cpp:53:35: error: ‘Caesar’ was not declared in this scope
   53 |           newCipher = make_shared<Caesar>();
      |                                   ^~~~~~
main.cpp:53:42: error: no matching function for call to ‘make_shared<<expression error> >()’
   53 |           newCipher = make_shared<Caesar>();
      |                       ~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/c++/11/memory:77,
                 from mes.h:4,
                 from main.cpp:1:
/usr/include/c++/11/bits/shared_ptr.h:875:5: note: candidate: ‘template<class _Tp, class ... _Args> std::shared_ptr<_Tp> std::make_shared(_Args&& ...)’
  875 |     make_shared(_Args&&... __args)
      |     ^~~~~~~~~~~
/usr/include/c++/11/bits/shared_ptr.h:875:5: note:   template argument deduction/substitution failed:
main.cpp:53:42: error: template argument 1 is invalid
   53 |           newCipher = make_shared<Caesar>();
      |                       ~~~~~~~~~~~~~~~~~~~^~
bdlmt commented 2 years ago

Okay, it wasn't a Makefile issue (though a Makefile would be nice). caesar.h was clobbered -- it's a copy of biginteger.h.

bdlmt commented 2 years ago

Thanks for the fix!